# Loading data from JSON without arrays

**URL:** <https://discourse.processing.org/t/loading-data-from-json-without-arrays/1557>\
**Category:** Beginners\
**Created:** [July 6, 2018, 5:35pm UTC](https://discourse.processing.org/t/loading-data-from-json-without-arrays/1557 "2018-07-06T17:35:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olygamy](https://avatars.discourse-cdn.com/v4/letter/o/dfb087/32.png) [@Olygamy](https://discourse.processing.org/u/Olygamy)\
**Post date:** [July 6, 2018, 5:35pm UTC](https://discourse.processing.org/t/loading-data-from-json-without-arrays/1557/1 "2018-07-06T17:35:55Z")

</div>

Hi there, I am working with API which give me JSON in this format:  
{“OBJECT NAME”:  
{“OBJECT.NAME#VAR112” : {  
“data01”: “BJECT.NAME#VAR112”,  
“data02”: “T-9F50. Serial Number: PI040298AA3I003620”,  
“data03”: “Grow.Thingful”,  
“data04”: 3  
},  
{“OBJECT.NAME#VAR113” : {  
“data01”: “OBJECT.NAME#VAR113”,  
“data02”: “T-9F50. Serial Number: PI040298AA3I003620”,  
“data03”: “Grow.Thingful”,  
“data04”: 3  
}  
}

There is no , only {} and there is the name of the object which is different every time (but the same as data01 … How can I parse for example all of the data02s from each object and list it? I am super clued up with working with arrays, but struggling here…any ideas?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 6, 2018, 6:50pm UTC](https://discourse.processing.org/t/loading-data-from-json-without-arrays/1557/2 "2018-07-06T18:50:51Z")

</div>

Maybe you should try out a `for..in () {}` loop: 🤔

> **[for...in](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)**
>
> The for...in statement iterates over all non-Symbol, enumerable properties of an object.

```auto
"use strict";

const jsonObj = {
  "OBJECT NAME": {
    "OBJECT.NAME#VAR112": {
      "data01": "BJECT.NAME#VAR112",
      "data02": "T-9F50. Serial Number: PI040298AA3I003620",
      "data03": "Grow.Thingful",
      "data04": 3
    },
    "OBJECT.NAME#VAR113": {
      "data01": "OBJECT.NAME#VAR113",
      "data02": "T-9F50. Serial Number: PI040298AA3I003620",
      "data03": "Grow.Thingful",
      "data04": 3
    }
  }
};

for (const name in jsonObj) {
  const vars = jsonObj[name];

  for (const entry in vars) {
    const datas = vars[entry];
    console.info(`${entry}:`);

    for (const data in datas) {
      const info = datas[data];
      console.log(`\t${data}: ${info}`);
    }

    console.log('\n');
  }
}

```
