Also look for '}' when scanning for end-of-value

This is for #6649 

cc @RaymondLim