I need to get the values of a custom field list type with sql. I extract the fieldparams value using

SELECT  fieldparams,id  FROM #__fields where context='com_content.article' and state=1

And i get a string like this


How do I convert this string into an array?

  • This question belongs to stackoverflow, because you are asking about converting JSON strings to PHP arrays, which is not primarily a Joomla question. Mar 1, 2018 at 11:01

1 Answer 1

$your_array = json_decode($json_data, true);

More about the decode options: http://php.net/manual/de/function.json-decode.php

More about JSON: http://php.net/manual/en/ref.json.php

  • 1
    This is backwards, Dennis. Mar 1, 2018 at 22:14
  • 1
    You can’t echo an array, Dennis. Mar 2, 2018 at 11:45
  • 1
    Thank you for giving a helping hand by pointing out things via comments, instead of just editing that obvious mistake, James. Mar 2, 2018 at 11:54
  • 2
    My pleasure. ;) Mar 2, 2018 at 23:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.