Field API - Custom JSON field

Hi,
I creat new plugin and register component as new field.
New field autocomplete address and show on map bellow.
I have problem with updating data of the field. I need insert data in JSON format.

Strapi Version 3.1.7
Environment: Develop
Node: v12.16.3
Npm: 6.14.4
Db: SQLite

This JSON looks like this:

    {
    city: "Paris",
    country: "Francie",
    fullAddress: "Paris, Francie",
    place_id: "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
    }

When maps successfully return data => call onChange from props and set new value of the target:

  const { name } = props;
    if (locationData) {
          props.onChange({
            target: {
              name,
              value: locationData,
              type: "json",
            },
          });
        }

After save strapi shows “Saved”, but data doesnt save to the DB. No errors in console.
I tried to save string instead of JSON data and that works and successfully saves to DB

Is there any solution to save data in JSON?

Can you link to an existing project so I can take a look at your implementation?

1 Like

Here is git repo: https://github.com/HonzaVrkota/strapi-location-input-field/tree/main/plugins/location-input

Is there any solution to solve this problem? Thanks!

You have no routes or controllers to send the data to, Strapi’s admin panel is just a CSR react application (meaning the client’s browser is rendering it), and it needs a route tied to a handler (controller) to send the information to, which then can save the information to the database.

Hi !

Is it possible to customize icon and display name of custom fields in content builder ?
I have a new field registered as “foo” and it’s shown “content-type-builder.attribute.foo” as label in content builder, How I can add a matching translation ?
Also, is it possible to set a custom column size for content manager sections ?