Mapping JSON response to entities

Mapping JSON response to entities

  

How much does a polar bear weigh?


Enough to break the ice, now let's get down to business.

I have attached an OML where my problem is quite clear I hope. I fetch a large JSON file and try the JSON2RecordList (JSONUtils component) this gives me 1 result.

I have looked at the ArdoJSON example oml and still can't get my head around how I map JSON to entities. Is there an 'explain like I'm 5' step by step tutorial one could follow? 


Any help would be appreciated, but most importantly of all: enjoy your weekend!

Hi Lars,

It's a bit difficult to tell what's going on without the actual JSON you're trying to parse. Could you include that as well?

EDIT: Never mind, I see it can be fetched from the URL in the OML.

EDIT 2: Are you sure this should be publicly available?

I would advise you to post this in the ArdoJSON component's forum, so it'll get the attention of those in the know...

Solution

Hi Lars,


I can see that you are using version 10. Is there any special reason to be using Richmal+JSONUtils instead of the builtin REST features? It's alot easyer and not error prone.

https://www.screencast.com/t/5JRXEROGNCL1

(I kept the entity you had and just converted the fields that matched to it in the assign, some were missing in the entity and you could decide to use the structure directly unless you really need to store that information in the database)


Also just a note about your module (I realize that this may be just as example, but still):

 - The On Initialize and On Ready callbacks should not be slow or make server accesses (as stated in the warning you have). Any slow operations to fill screen information should use a Data Action.


Regards,
João Rosado

Solution

João Rosado wrote:

Hi Lars,


I can see that you are using version 10. Is there any special reason to be using Richmal+JSONUtils instead of the builtin REST features? It's alot easyer and not error prone.

https://www.screencast.com/t/5JRXEROGNCL1

(...)


João Rosado


! ! ! !


João, you absolute madman! What an amazing solution to my problem! And let me give you a special thank you for taking the time and recording an actual implementation of your proposed solution! 


Thank you. 

(Damn, what a great way to start the week, one big obstacle out of the way now)