halecommarachel has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, I have a data structure that I'm converting to a json string, which I then write to a file. The json file is used for a database. To convert the strings containing only digits to numbers, I add zero and then store in the structure. For some reason, when I look at the json file, some strings that were supposed to be converted to integers are still strings. Is there any way to guarantee a string is converted to a integer? Thanks!
So a data dump looks good: 'cl_ip' => 209889, But there's a string in the json file for this key: "cl_ip":"209889"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: String to Integer, for json file
by davido (Cardinal) on Dec 12, 2013 at 05:39 UTC | |
by tangent (Parson) on Dec 12, 2013 at 09:38 UTC | |
by Anonymous Monk on Dec 12, 2013 at 09:45 UTC | |
by halecommarachel (Sexton) on Dec 12, 2013 at 16:38 UTC | |
|
Re: String to Integer, for json file
by karlgoethebier (Abbot) on Dec 12, 2013 at 08:51 UTC | |
by Anonymous Monk on Dec 12, 2013 at 09:35 UTC | |
by halecommarachel (Sexton) on Dec 12, 2013 at 19:47 UTC | |
by karlgoethebier (Abbot) on Dec 12, 2013 at 20:03 UTC | |
|
Re: String to Integer, for json file
by Anonymous Monk on Dec 12, 2013 at 09:50 UTC |