Summary:ASTERISK-09199: Proper escaping of JSON elements in GetConfigJSON
Reporter:Pari Nannapaneni (pari)Labels:
Date Opened:2007-04-05 11:20:09Date Closed:2007-07-09 21:20:52
Versions:Frequency of
Description:Background: getconfigjson was added recently as an experimental feature
to output config files in JSON format.

Current Output is

the problem is if there are special characters - like "
in line1 or line2, the JSON output can not be properly parsed to a
JSON object on the other end.

So we need to find the right way the JSON standard expects these LineX's
are to be encoded in, and use the same escape/encoding on all LineX's.


Using a JSON library (http://oss.metaparadigm.com/json-c/) to construct the JSON output makes life a lot easier but including "Yet another library" for just building a one level JSON string might be too much. Use of such a library makes more sense when we are building complex JSON objects with 3 or 10 sub levels or when we are decoding complex JSON data. But here we are just building a simple one level string. so use of those libraries might me an overkill.

Comments:By: Russell Bryant (russell) 2007-04-23 13:52:24

I have committed a fix for this in revision 61767.  I have it escaping '\' and '"'.  I think that should be enough for what we're doing here.  Let me know if you have any more problems.