Add scalar type metadata refinement for JSON profiles

Add a header for this function, which is the meaty one.