I'm trying to store multiple field values in a JSON string in my component but I'm not quite sure how to go about it. I've done some research and it seems that using the load and bind JTable methods are the way to go but I don't know how to render the fields on my form and vice versa.

Any tips or advice would be appreciated!

1 Answer 1


You can do it either in your Table class or Model class:

// Convert a JSON field to an array
$registry = new JRegistry;
$item->jsonfield = $registry->toArray();

See the reference

And vice versa:

// Convert an array field to a JSON
if (isset($data['jsonfield']) && is_array($data['jsonfield']))
    $registry = new JRegistry;
    $data['jsonfield'] = (string) $registry;

See the reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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