Making a custom field , which computes its value in value code and returns a json array.

In value code, sql query returns a result which is json encoded !

it works properly , result is returned correctly in the preview but not when the end-point is called !

Expected Result:-

[
  {
    "Nid": "32",
    "PHP": "[{"dish1_like":"0","dish2_like":"0","dish3_like":"3","dish4_like":"0","dish5_like":"3","dish1_dislike":"4","dish2_dislike":"4","dish3_dislike":"0","dish4_dislike":"2","dish5_dislike":"1"}]"
  }]

Result returned :-

[
  {
    "Nid": "32",
    "PHP": "[{"dish1_like":"0","dish2_like":"0","dish3_like":"3","dish4_like":"0","dish5_like":"3","dish1_dislike":"4","dish2_dislike":"4","dish3_dislike":"0","dish4_dislike":"2","dish5_dislike":"1"}]"
  }]

the php property is returned by value code !

it reutrns &quote; instead of actual " .

Comments

Sumeet Darade created an issue. See original summary.

kylebrowning’s picture

Status: Active » Closed (fixed)

This is a custom field that has JSON in it? Im sorry but we can't really support that from Services.

You need to alter the response from services to handle your custom case.

Look at services.api.php for ways to do so.