Populating jsonform with saved data

So we have schemas en uischemas that come from a location that we load, a user can fill them out and save. They can come back later to update the form as they see fit.

Now the problem I am running into is: I want to display saved data into the form. An assumption was to load the schema, then load the data, update the schema with the data and then feed the schema into the jsonforms renderers. This happens to be quite a bit more complex than i think it should be, and maybe i am approaching this the wrong way.

So the question is, what is the best approach for pre-filling a jsonform with data saved somewhere else to show the user?

Hi @richardj ,

as I understand it, you load the schema, ui schema and possibly the data (if any) from a remote location (e.g. a REST service). Your problem is that you want to show loaded data in the form but it does not work for you. Is this correct?

An assumption was to load the schema, then load the data, update the schema with the data and then feed the schema into the jsonforms renderers

Could you elaborate a bit more on that, please? Why do you need to update the schema with saved data?

If you “just” need to show loaded data in the form, the simplest solution likely would be to load schema, ui schema and data (if none was saved, initial/empty data could be returned). After everything is loaded hand all of that into JsonForms.

1 Like

Hi Lucas,

My approach was totally wrong by assuming that a default state would be provided by the schema, like a default value, but of course that is all handled by the data itself.

Thanks for the reply, we have it fixed and working correctly now :slight_smile:

2 Likes