Closed ghost closed 8 years ago
It's getting double encoded. I think you should just return the array in your function, and the plugin will handle json encoding it.
Yep - Fixed it:
protected function entries_j_array($entry_id, $field, $field_data)
{
$my_array = explode("\n", trim($field_data));
foreach ($my_array as $k => $v)
{
$my_array[$k] = trim($v);
}
return $my_array;
}
P.S. Thank you for the awesome add on!
Hi, I created a custom field type uses the text field and explodes the text on new lines, trims, then json_encodes the result so the output looks like:
["test","testing","tester","testy","testtesttest"]
But when I added it into your json plugin it's outputting as:
json_array: "["test","testing","tester","testy","testtesttest"]",
Is there an easy way to have the output not enclosed in quotes?
Here's the custom function I added: