I have a list view connected to a JSON app-state variable that is populated from an API response body.
Typically, if there are messages in the response, the body looks something like this:
{
"messages": [
{
"id": 7,
"created_at": 1694075834515,
"role": "system",
"content": "Your name is Adam and in Arabic it is \"ุขุฏู \" you are an expert on all male issues.\nYou are talking to Michael a Male from USA. You'll speak English to talk back to them.",
"index": 0,
"conversations_id": 3
},
{
"id": 8,
"created_at": 1694075922458,
"role": "user",
"content": "hello adam how are you ?",
"index": 0,
"conversations_id": 3
},
{
"id": 9,
"created_at": 1694075922522,
"role": "assistant",
"content": "Hello Michael, I'm doing well, thank you! How about you? How can I assist you today?",
"index": 0,
"conversations_id": 3
}
]
}
and this is how it looks in the app (screen 1).
But if there are no messages. the response body looks like this:
{
"messages": {}
}
and this is how it looks in the app (screen 2)
What I want is to display nothing instead of "null"