[ardoJSON] New feature: Specify the name of the object in the JSON file

[ardoJSON] New feature: Specify the name of the object in the JSON file

  
Forge Component
(21)
Published on 30 Aug by Ricardo Silva
21 votes
Published on 30 Aug by Ricardo Silva
Hi Ricardo,

Is it possible to add an optional parameter to the action Outsystems2JSON to specify the name of the object (instead of always assuming that has the same name of the structure)?

We need this because we need to build and maintain an API, with different versions, in the same espace. With time, the objects will change but we need to maintain retrocompatibility.

For example:

Event
- Date
- Description

In the next version:

EventV2
- Date
- Description
- Author

We don't want that our apps change the name of their dictionaries only because we aren't able to define the name of the object in JSON. 

Is it possible to do that change? If you don't desire that change, can you just give me a quick hint in your code on where I could do myself that change?

Thanks
Can you please elaborate on the specifics of what you want to implement?

JSON objects don't have a name and all matching in ardoJSON is done by structure, not by name of the Record.

I look at attribute names, not Record name.

Also, you should specifically version your JSON API instead of allowing for legacy calls.
I think what Ricardo mentioned is that the generated json never contains the name of the structure. Can you post a json where it is appearing?

Also if its just adding attributes it should not be a "breaking change" that required you to create a separate structure. A good rest client should ignore unknown attributes.

Regards,
João Rosado
I rest my case :)

The names, in my case, were always the same and I never noticed how it really worked.

PS - I've deleted my previous post because it was dumb and if other people read this thread, not confuse them even more.