Using json properties for form schema

I have a form that uses a model on laravel with a json column. Inside there are some properties. There are tags and difficulty level inside but when saving, it overwrites the whole json instead of just changing the correct property.

A simple example of a json column value (column name is metadata):
{
  "tags": [
    "Beauty & Health",
    "Health Care",
    "Massage & Relaxation",
    "Physiotherapy",
    "Acupressure",
    "Reflexology",
    "Acupressure Socks",
    "Massage Socks",
    "Foot Massager"
  ],
  "difficulty": {
    "level": 42
  },
  ...restProperties
}

The TagsInput and the TextInput I use work, and it saves, but then the metadata column is becoming only tags and difficulty.

The form components part of the schema:
TagsInput::make('metadata.tags')
                    ->separator(',')
                    ->splitKeys(['Tab', 'Enter', ',']),

                TextInput::make('metadata.difficulty.level')
                    ->type('number')
                    ->minValue(1)
                    ->maxValue(100),

Obviously I am doing something wrong, but I can't find something in the docs relating to that.
Was this page helpful?