Using JSON file as a data source for an Entity

0
Hi everyone I have a JSON file and I've created a JSON structure in Mendix, but I still can't find a way to use the JSON as a data source for an entity I don't want to Create  a server API Any idea
asked
2 answers
0

What you did there was create a non-peristable entity that will hold the data provided in your JSON file. So, per every JSON object you will create a new JsonObject entity in Mendix which will hold all the values. Depending on your requirements, you might want to change your JsonObject to a peristable object instead, if you want to keep it in your database indefinitely.

As to how to import JSON files themselves – you can look at the Community Commons action StringFromFile and then use Import with Mapping action. Might be worth reading through this to understand the process better: https://academy.mendix.com/link/modules/313/lectures/2368/4.2.1-Create-JSON-Import 

Edit:

Creating a new Import Mapping using an existing JSON only creates the underlying database model – it does not copy objects over from JSON to Mendix. To do that, you need to create a microflow that accepts a JSON string, then using Import Mapping you can create Mendix objects, like so:

The JSON string in my case is just a String variable I created inside the microflow, but the way you provide the JSON string can be whatever you want it to be – FileDocument, text box on a page, API call etc.

answered
0

hi,
Ilja Cuvasov thank you for the reply
exactly that what i want.
i want to create an object in JSON object entity for each JSON object
All the object are saved in the JSON file && JSON structure 
but as showing the entity still empty i changed the entity to persistable.
i am not using Rest server (API) to import data from database
the only thing that i want are to import the JSON File Object.

answered