I’m dealing with an api that returns for XML for some values int or 0 if there is no value – this is how it should be IMHO, but for JSON it returns int or boolean false if there is no value. Does it mean that it’s poorly written api or JSON and XML values can differ? I thought it should be always the same and completely interchangeable.
Share
The answer is that xml and JSON are not the same in there own typing system, so they should not provide the same answer. Stronly typed: 0 is a good answer when item not found (exception should be better) but in loosy typed JSON false is to be preferred. Use the freedom the loosy typed environment gives you. So both api’s doesn’t have to be completely interchangeable.