JSON definition not accepted by php json_decode

Hi Isomorphic

I am using a isc.DataSource with dataFormat:‘json’. The raw data sent to a PHP server is :

{id:19,ParentId:3,Abr:"Dey",Name:"Fr."}

It is a problem to process the JSON object delivered by the datasource with the PHP command json_decode( $data ) on the server side. I found the problem.
According to RFC4627 the key in a JSON object is defined as a string.
Consequently the correct format of a JSON object should be:

{"id":19,"ParentId":3,"Abr":"Dey","Name":"Fr."}

Is there any possibility to make the datasource send the correct string to the server.
Thank you very much for help.

Hi uh,

What you’re seeing is not actually related to isc.DataSource or dataFormat:“json”, that’s an internal serialization format similar to JSON that SmartClient uses if you pass an HTTP parameter as a non-String.

If you want to be able to transmit structured objects to your server, we would recommend either:

  1. using a RestDataSource and setting dataProtocol to “postMessage”, which will result in XML produced by dataSource.xmlSerialize()

  2. if you must use JSON, using any third-party JSON library to encode your data as JSON before you pass it to SmartClient for transmission (eg, from dataSource.transformRequest())