Ahmed-Ali / JSONExport

JSONExport is a desktop application for Mac OS X which enables you to export JSON objects as model classes with their associated constructors, utility methods, setters and getters in your favorite language.
Other
4.8k stars 794 forks source link

Feature request: type safe / check and casting of incorrect yet castable/adaptable values #109

Open nissaba opened 6 years ago

nissaba commented 6 years ago

Hi, ok I may be asking for a lot here. but if this is possible it will be kick ass.

I get my JSon from a API service that will try to reduce the JSON to a minimum. So what happens is that say for a JSON like {"a": [{object 1}, {object 2}, ... {object n-1}, {object n}]} if the system only needs to return 1 object in array "a" it will send instead {"a":{object1}} so this needs to be adapted to an array [object1]

an other thing that it does is say we are supposed to get a string in some field.. {"s": "hello world"} but the server needs to return a string that is numeric only say a phone number with not formating characters, for example 15145555555 will get {"s": 15145555555}. But this number can be cast to a string.

And also lastly the hardest point is Some API will return a JSON structure where the first part is always the same but the will attache varied object.

for example the result for a request for a person {"status": true, "data":{... persone data ...}} and for say result for a painting description {"status": true, "data":{... painting data ...}}

it would be nice that we can in the JSON we give to JSONExport some tags or what not that will let it know that the object is dynamic. I know this will use PATs but this would get JSONExport to the next level. example {"status": true, "data":{#Dynamic#}} or {"status": true, "data":}