Hello :)I'm building a web service with this output structure
For example, the stateTechVisitLogOfChange field is a list of values, but when this list has no results, it is presented like this
it is possible to return the stateTechVisitLogOfChange list but presenting the stateTechVisit, dateOfChange and dateOfChange columns. This way
stateTechVisitLogOfChange":[stateTechVisit:"", dateOfChange:"1901-01-01",dateOfChange:""]
Is there a native solution or do I have to make a list append to a dummy record?tks
João Vilelas
Hi João,
If it doesn't find results it will show the empty list. but if you want to have a record created, when it is empty, yes you have to create a dummy record.
I think the most correct way is to go empty.
Agree
To me, the expectation to display this JSON when the list is empty is not correct, it violae the syntax of JSON:"stateTechVisitLogOfChange":[stateTechVisit:"", dateOfChange:"1901-01-01",dateOfChange:""]
as "stateTechVisitLogOfChange is a list of Object, so it would be:
- "stateTechVisitLogOfChange":[] -> List empty- "stateTechVisitLogOfChange":[{}] -> List with 1 child Object, child Object is Empty object- "stateTechVisitLogOfChange":[{"stateTechVisit":"", "dateOfChange":"1901-01-01","dateOfChange":""}] -> List with 1 Object, and the Object is initialize with default data type value. This is closet to what your expectation. To achieve this, you may add some logic to check if stateTechVisitLogOfChange.IsEmpty = True then add a dummy structure to the list. (But in my opinion, this is not quite correct, as it removes the value of Emptiness.