Object definition in API and read multiple object from JSON
Posted: Tue May 14, 2024 6:58 pm
Hello all,
I hope everyone is doing well
I'm currently working on an API project to externalize Micro Services.
1- Regarding the GET method, I was able to create an API that retrieves results from multiple tables and returns the JSON in the following format:
Example:
{
"level1": {
"level2": "Value at level 2",
"level2": "Value at level 2"
}
}
My schema is :
- The issue here is that if I have 3 levels:
{
"level1": {
"level2": {
"level3": "Value at level 3"
}
}
}
I'm unable to get the correct JSON result; the array created for level 3 is always empty.
2- Concerning the POST method, I want to insert all 3 levels of a JSON that I receive. After declaring the 3 levels in LANSA, the insertion is only done for the first element of the JSON, in my case here just the Level 1 is inserted into the database.
I'm not sure if I'm overlooking something in my code, misunderstanding how to define objects, or if this task simply cannot be accomplished with Lansa
Thanks to everyone who took the time to read my post.
Best Regards,
I hope everyone is doing well
I'm currently working on an API project to externalize Micro Services.
1- Regarding the GET method, I was able to create an API that retrieves results from multiple tables and returns the JSON in the following format:
Example:
{
"level1": {
"level2": "Value at level 2",
"level2": "Value at level 2"
}
}
My schema is :
- The issue here is that if I have 3 levels:
{
"level1": {
"level2": {
"level3": "Value at level 3"
}
}
}
I'm unable to get the correct JSON result; the array created for level 3 is always empty.
2- Concerning the POST method, I want to insert all 3 levels of a JSON that I receive. After declaring the 3 levels in LANSA, the insertion is only done for the first element of the JSON, in my case here just the Level 1 is inserted into the database.
I'm not sure if I'm overlooking something in my code, misunderstanding how to define objects, or if this task simply cannot be accomplished with Lansa
Thanks to everyone who took the time to read my post.
Best Regards,