Which field method for a custom stored field content?

Hi,

i am on developing a panel field plugin which creates a list of fields.

This stores as a string like following on a /content/... .txt file:

Anchornavigation: [{"label":"Foo","anchor":"foo","_id":1},{"label":"Hello","anchor":"hello","_id":2},{"label":"That title","anchor":"that-title","_id":3}]

All fine on the panel side so far.
I would say…

But on the output in a template i can not find a right field method to get a proper array back in PHP template.

Plain var_dump output is

object(Kirby\Content\Field)#514 (1) { ["anchornavigation"]=> string(136) "[{"label":"Foo","anchor":"foo","_id":1},{"label":"Hello","anchor":"hello","_id":2},{"label":"That title","anchor":"that-title","_id":3}]" }

with some methods chaining like

$anchorWat = $anchorNavigation->json(); // field method
$anchorAgain = json_decode($anchorWat->value());

i got a proper array i can use:

array(3) { [0]=> object(stdClass)#763 (3) { ["label"]=> string(3) "Foo" ["anchor"]=> string(3) "foo" ["_id"]=> int(1) } [1]=> object(stdClass)#731 (3) { ["label"]=> string(5) "Hello" ["anchor"]=> string(5) "hello" ["_id"]=> int(2) } [2]=> object(stdClass)#766 (3) { ["label"]=> string(10) "That title" ["anchor"]=> string(10) "that-title" ["_id"]=> int(3) } }

Do I miss a suitable output field method or would this be the way to go for?

May i could/should write a custom field method in the plugin?

Yes, a custom field method would be the way to go.