hwkim418 Posted November 25 Report Posted November 25 I’m working on a LabVIEW application that retrieves measurement logs from Firebase. The Firebase API returns data as a nested JSON object where each entry has an auto-generated key. Each entry contains fields such as DATE, TIME, RESULT, TEMP, etc. My goal is to parse this JSON into a 2D string array so that each Firebase record becomes one row in a LabVIEW table indicator. I’m using the JSONtext library, but I’m having difficulty iterating through the nested keys and reliably building each row. My main issues so far: The top-level object contains dynamic child names (-Obew83hY0lgN7ac7JK0, -ObewEcv8G0LtSRTx92G, etc.), so I cannot index them directly. When I extract values using Get JSON Object Keys + Unflatten from JSON, the order of keys is not guaranteed, so my 2D table rows become misaligned. Attempts to build rows inside a loop give me only a 1D array unless I carefully manage the auto-indexing tunnels. Here is a minimal reproducible example of the Firebase response:Has anyone done this before or can provide an example of how to reliably transform Firebase JSON data into a LabVIEW table? {"data": { "-Obew83hY0lgN7ac7JK0":{"DATE":"20251015","RESULT":"NG","TEMP":"20.2\\r\\n","TEMP_MAX":0,"TEMP_MIN":0,"TIME":"21:54:09 "}, "-ObewEcv8G0LtSRTx92G":{"DATE":"20251015","RESULT":"OK","TEMP":"","TEMP_MAX":0,"TEMP_MIN":0,"TIME":"21:54:29 "}, "-OeUEMm0u55cSRyy4OhH":{"DATE":"20251119","RESULT":"OK","TEMP":"","TEMP_MAX":0,"TEMP_MIN":0,"TIME":"21:09:57 "}, "-OeUEO-CYBUUw_gtiab9":{"DATE":"20251119","RESULT":"OK","TEMP":"","TEMP_MAX":0,"TEMP_MIN":0,"TIME":"21:10:02 "} }} Quote
Francois Normandin Posted Thursday at 12:18 AM Report Posted Thursday at 12:18 AM @hwkim418 There are many ways you can go about this. Here's a few examples using JSONtext. (VI saved in LV 2019) object_deserialization.vi 1 Quote
hwkim418 Posted Thursday at 04:01 AM Author Report Posted Thursday at 04:01 AM I genuinely appreciate your help! Quote
Stagg54 Posted 7 minutes ago Report Posted 7 minutes ago You might check out this https://www.vipm.io/package/pantherlab_lib_firebase_api/ It simplifies the connection process. Although it does still return json, so you'll need to parse it using JSON text or something similar as Francois mentioned. Quote
Stagg54 Posted 5 minutes ago Report Posted 5 minutes ago It does support filtering though, so you can just grab the latest or a certain number. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.