Menu

The function cJSON_Print does not escaped the forward slashes

TZOLL
2013-09-05
2013-09-05
  • TZOLL

    TZOLL - 2013-09-05

    Hello,

    I tried to use the function cJSON_Print and saw that the forward slashes (solidus) are not escaped.
    Example:
    {
    "tests": [{
    "id": "1",
    "test": "/group1/subgroup1/"
    }]

    }

    The string definition (http://www.json.org/string.gif) in my opinion shows, that the forward slashes (solidus) have to be escaped.

    Could you check, whether this is an error in cJSON?
    Thanks

     
  • Dave Gamble

    Dave Gamble - 2013-09-05

    Yeah, it's fine. It will accept escaped solidus in input, and there's no ambiguity in non-escaped solidus in output.

    Output only needs to escape as much as could be ambiguous. Input must be permissive.

    If you have an application that requires it, it's trivial to add, but I won't push to main branch.

     

Log in to post a comment.