Jump to content

jSON Structure trustful?


Tranquil

Recommended Posts

Tranquil

Hello Devs.

 

I've got a feature request depending the answers coming from MBS in json format:

 

I'm working on a general module for a MB implementation in my projects. Working fine so far. ATM I have a predefined structure of all members and key types from the swagger UI in my source. The benefit of it is, that I do not have to parse the complete json server answer for each object to write it into my structured list. If the structure is the same every time I can just say "put that json object into that structure cause it fits!" This only works, if there are no changes on the structure (order of objects, new objects...)

 

As my version will break when new objects are added, I believe so, is it possible to tell the server something like a MBS build number to be sure, to get the answer in the same structure as I got before?

Link to comment
Share on other sites

Koleckai Silvestri

You're language should have a method to convert the JSON result into an array or object. You can then reference the elements by name. This way if the structure changes in the future, you can still reference your objects properly.

  • Like 1
Link to comment
Share on other sites

No, I don't think this would be possible.  We try to change the model objects as little as possible but changes do happen (mostly additions).  The best thing to do is use our common module available on NuGet and keep it up to date so that you're sure you have the proper model.  You can also use the entire ApiClient implementation for your target language (java, js or c#) and then you are isolated from any of these changes.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...