LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW JSON Parsing – How to Handle Array of JSON Objects from REST API

Solved!
Go to solution

 

Hi Everyone

Currently, the API is returning the Details field as an array of JSON strings, for example:

"Details": [
  "{\"ID\":706,\"Item\":\"012026032100238\",\"User\":\"15314,SUPERVISOR\",\"DT\":\"14-04-2026 13:32:21\"}"
]

For Android integration, I need the API to return Details as a proper JSON array of objects instead of strings.

The expected response format is:

{
  "code": 200,
  "message": "Details fetched successfully",
  "data": {
    "md": {
      "Name": "SR-RM-F-103",
      "Partition": "1",
      "Partition_Qty": "25",
      "ID": "706"
    },
    "Details": [
      {
        "ID": 706,
        "Item": "012026032100238",
        "User": "15314,SUPERVISOR",
        "DT": "14-04-2026 13:32:21"
      },
      {
        "ID": 706,
        "Item": "012026032100240",
        "User": "15314,SUPERVISOR",
        "DT": "14-04-2026 13:35:32"
      }
    ]
  }
}

In LabVIEW, please ensure that each JSON object is added directly to the Details JSON array. It should not be converted/flattened to a string before adding it to the array.

The final JSON should be flattened to a string only once, at the end, when sending the HTTP response.

This will allow the Android application to directly consume the Details array without additional JSON parsing.

0 Kudos
Message 1 of 2
(558 Views)
Solution
Accepted by topic author Tusharvp4

Yamaeda_1-1790761685389.png

JSONtest package in VIPM is a good help.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 2
(515 Views)