Closed XaeroDegreaz closed 10 years ago
When you use JsonMapper.ToObject on a string that contains an empty array ("somearray":[]), it seems to break things. Take this valid JSON, for example:
{ "responseType": "success", "billingIsPastDue": false, "data": { "contacts": [ { "id": 782, "first_name": "jo", "last_name": "schmo0", "phone_number": "31622255447", "email": null, "contact_owner_id": 1, "company_id": 2, "hash_tags": [], <---- EMPTY, causes issues -- see below "facebook": null, "linkedin": null, "twitter": null, "geo_location": null, "referred": null, "referral_id": "778", "notes": null, "is_blacklisted": 0, "contact_progress": 64 } ] } }
When serialized, it produces this string:
[...] { "id": 782, "first_name": "jo", "last_name": "schmo0", "phone_number": "31622255447", "email": null, "contact_owner_id": 1, "company_id": 2, "hash_tags": "facebook": null, <--- WOOPS, how'd this happen?? "linkedin": null, "twitter": null, "geo_location": null, "referred": null, "referral_id": "778", "notes": null, "is_blacklisted": 0, "contact_progress": 64 } [...]
Barring this issue that I just came up on, this is a great tool and I hope to see this fixed soon :)
This seems to have been fixed some time ago, in commit https://github.com/lbv/litjson/commit/9a2605be3ba84da1f7505c6d26ca47b1987389f4
When you use JsonMapper.ToObject on a string that contains an empty array ("somearray":[]), it seems to break things. Take this valid JSON, for example:
When serialized, it produces this string:
Barring this issue that I just came up on, this is a great tool and I hope to see this fixed soon :)