Skip to main content
2 of 2
added 151 characters in body
Brad Bell
  • 67.6k
  • 6
  • 75
  • 145

Completely untested, but a possibility would be to define your content attribute like so:

return array(AttributeType::Mixed, 'model' => 'MyPluginContentModel');

MyPluginContentModel would have every possible value that you would want to expose to your template ('id', 'obj', 'etc') defined as an attribute.

When Craft pulls the JSON from the database, it should decode it and populate your model with any matching attributes it finds.

That gets returned to your template and you can access it via {{ value.id }}.

Brad Bell
  • 67.6k
  • 6
  • 75
  • 145