FilamentF
Filament3y ago
Xane

Is there a way to use statePath with nested json-data?

Hello! I'm wondering if anyone knows if there is any way to use statePath to get nested json properties?

DB Field: "Nutrient"
JSON: {"Details": [{"NutrientTypeCode":"ENER-","Value1":"1724"}, ...]}

I would like to get "NutrientTypeCode".

This is what I've got so far, it shows me all the detail objects, but I don't know how to target the field I want:

Forms\Components\Section::make('Nutrient')->statePath('Nutrient')->schema([ Forms\Components\TextInput::make('Details'), ]),

This is as far I've gotten with it. I've tried "Details.NutrientTypeCode", but this doesn't give me any data.

Do I have to create my own form-field for this?

Thanks!
Was this page helpful?