Ad Widget

Collapse

Error parsing JSON in API when it has word with special character

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • renatodinhani
    Junior Member
    • Feb 2013
    • 2

    #1

    Error parsing JSON in API when it has word with special character

    Hi, I have the following JSON to create a new IT Service, but the word "Aplicação" causes an ""Invalid JSON. An error occurred on the server while parsing the JSON text." error.

    If I change this word to other without special chars, it works fine.

    {
    "id":1,
    "method":"service.create",
    "params":{
    "showsla":1,
    "sortorder":0,
    "goodsla":99.99,
    "name":"Aplicação",
    "parentid":"0",
    "algorithm":1
    },
    "jsonrpc":"2.0",
    "auth":"thesecretauth"
    }

    There is a way to pass a word with special char in the API? When I use the web interface, it works perfectly.
  • Pavels
    Member
    • Oct 2011
    • 83

    #2
    Strange, it should handle special characters. Could you check what version of PHP you are running and do you have the JSON extension available?

    As a work around you can try to encode the text as unicode as described in the JSON spec http://www.json.org/, this format is supported as well.

    Comment

    Working...