0
I wonder if there is any problem involved in passing the values of the keys in JSON all as string or if there is any justification to always keep the original types of data?
My question is based on the fact that a while ago I had some problems with passing values in Float, specifically in PHP with json_encode, and in one OS topic had found an explanation of the problem, which was even the solution (https://stackoverflow.com/questions/42981409/php7-1-json-encode-float-issue). Meanwhile I always passed all float values of a JSON as String in developing API’s to avoid this kind of problem.
Is there any recommendation/justification regarding the typing or not of the values in JSON when developing an API? Or is it really something "irrelevant" and is at the mercy of the developer set the standard that is useful to you?
I ask this because I’ve had to consume API’s with several different types of patterns, either passing all values as String, or maintaining the original typing of values, some even performing the mixing of the two situations (some keys with integer/decimal values as string others keeping typing).
I had imagined that it was really this, considering that there were no other answers, I suppose that in fact it did not have a "recommended standard" for this. Thank you.
– Vinicius Gabriel