[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: dealing with null (not nil)
- From: Dave Collins <Dave.Collins@...>
- Date: Wed, 27 Jul 2011 11:17:30 -0400
I've just discovered that http://jsoneditor.net/ is mangling my data.
Our API delivers empty strings as mykey="". Now that I am setting up my app to run off either live API data or local .json file, I need to be able to edit the json file manually.
But after I make mods, the editor publishes my data - not as mykey="", but as mykey=null - which my app chokes on.
(It also mangles numbers. It turns mykey="2" into mykey=2.) The nerve!!
Anyway, I can deal with the number problem, simply by wrapping it in tostring(). How do I deal with a null? Does lua have an isnull() function?
(I hate this idea that the editor is molesting my data. I can no longer count on my api data to be identical to my local file. Maybe I need to find a better editor. Maybe I need to complain to katamari that their editor molests my data.)
Or maybe I should make a mod to my json parser (dkjson) to have to autoconvert null to "".
Dave Collins
Front-End Engineer
Mercatus Technologies Inc.
60 Adelaide Street East, Suite 700
Toronto ON M5C 3E4
T 416 603 3406 x 298
F 416 603 1790
dave.collins@mercatustechnologies.com
www.mercatustechnologies.com