nest items in JSON based on value? - javascript

Trying to get my head around this one..
Incoming data looks like:
[
{
"value": {
"label": "MZ Algal bloom",
"type": "case",
"incident": {
"name": "Algal bloom"
},
"personName": "Lionel Carter"
}
},
{
"value": {
"label": "BW Algal bloom",
"type": "case",
"incident": {
"name": "Algal bloom"
},
"personName": "Jerome Yost"
}
},
{
"value": {
"label": "Detergent",
"type": "case",
"incident": null,
"personName": "Jerald Legros"
}
}
]
I would like to transform this into
[
{
"label": "Algal bloom",
"children": [
{ "label": "Lionel Carter", "type": "case"},
{ "label": "Jerome Yost", "type": "case" }]
},
{ "label": "Detergent", "type": "case" }
]
Basically, the rule is that if incident is not NULL then the incident name becomes the parent and the children hold the personName - otherwise we simply pass through the label and type. I can walk the array and switch out the label with the incident name, but I'm not sure how to group up the incidents..

It's basic grouping with an exception for elements without incident.
You can group the elements without incident in a separate group:
const data = [{"value": {"label": "MZ Algal bloom","type": "case","incident": {"name": "Algal bloom"},"personName": "Lionel Carter"}},{"value": {"label": "BW Algal bloom","type": "case","incident": {"name": "Algal bloom"},"personName": "Jerome Yost"}},{"value": {"label": "Detergent","type": "case","incident": null,"personName": "Jerald Legros"}}];
function group(data) {
const result = data.reduce((acc, { value }) => {
if (!value.incident) {
acc.ungrouped.push({ label: value.label, type: value.type });
} else {
if (!acc.groups[value.incident.name]) acc.groups[value.incident.name] = { label: value.incident.name, children: [] };
acc.groups[value.incident.name].children.push({ label: value.personName, type: value.type });
}
return acc;
}, { groups: {}, ungrouped: [] });
return [...Object.values(result.groups), ...result.ungrouped];
}
console.log(group(data));

Related

Javascript json into nested json

I have a huge json which I am fetching from Excel sheet.
Data I am getting as array of objects and one object looks like below.
[
{
"key": "guid",
"parent": "id__guid"
},
{
"key": "version",
"parent": "id__version"
},
{
"key": "register",
"parent": "register"
},
{
"key": "offloadId",
"parent": "offloadId"
},
{
"key": "action",
"parent": "action"
},
{
"key": "reported",
"parent": "reported"
},
{
"key": "control",
"parent": "control"
},
{
"key": "AppNum",
"parent": "Identification__AppNum"
},
{
"key": "DataTp",
"parent": "Identification__DataTp"
},
{
"key": "DtOgWatchDt",
"parent": "Identification__DtOgWatchDt"
},
{
"key": "DtPendingWatchDt",
"parent": "Identification__DtPendingWatchDt"
},
{
"key": "IssRef",
"parent": "Identification__IssRef"
},
{
"key": "ImgRef",
"parent": "Identification__ImgRef"
},
{
"key": "Register",
"parent": "Identification__Register"
},
{
"key": "-",
"parent": "Identification__ImgRefFullPub"
},
{
"key": "DtAppDt",
"parent": "Dates__DtAppDt"
},
{
"key": "IdxNam",
"parent": "Description__IdxNam"
},
{
"key": "Clms",
"parent": "Description__Clms"
},
{
"key": "Disclaims",
"parent": "Description__Disclaims"
},
{
"key": "LglStsCd",
"parent": "Status__LglStsCd"
},
{
"key": "UsPtoStsCd",
"parent": "Status__UsPtoStsCd"
},
{
"key": "PtoStsCdDt",
"parent": "Status__PtoStsCdDt"
},
{
"key": "StsFlag",
"parent": "Status__StsFlag"
},
{
"key": "SrcInd",
"parent": "Status__SrcInd"
},
{
"key": "LglStsCdNorm",
"parent": "Status__LglStsCdNorm"
}
]
I want to convert it into this format which is nested json.
[
{
name: "Identification",
fields: [
{
"key": "AppNum",
"parent": "Identification__AppNum"
},
{
"key": "DataTp",
"parent": "Identification__DataTp"
},
{
"key": "DtOgWatchDt"
},
{
"key": "DtPendingWatchDt"
},
{
"key": "IssRef"
},
{
"key": "ImgRef"
},
{
"key": "Register"
},
{
"key": "ImgRefFullPub"
},
{
"key": "guid"
},
{
"key": "version"
},
{
"key": "offloadid"
},
{
"key": "reported"
},
{
"key": "control"
}
]
},
{
name: "Description",
fields: [
{
"key": "IdxNam"
},
{
"key": "Clms"
},
{
"key": "Disclaims"
}
]
},
{
name: "Status",
fields: [
{
"key": "UsPtoStsCd"
},
{
"key": "PtoStsCdDt"
},
{
"key": "LglStsCd"
},
{
"key": "StsFlag"
},
{
"key": "SrcInd"
},
{
"key": "LglStsCdNorm"
}
]
},
{
name: "Dates",
fields: [
{
"key": "DtAppDt"
}
]
}
]
As you can see according to parent key we have to create nested structure.
I have tried all the ways, I search a lot on google also, but hard luck.
Any help will be appreciated.
You'll want to create a new array of objects, then loop through the original array and add entries to the new array based on that. For example --
const input = [
{
"key": "guid",
"parent": "id__guid"
},
{
"key": "version",
"parent": "id__version"
}
// et cetera... your input
];
// these are buckets.
const transformedObject = {
"Identification": []
}
// First we put the data into the right buckets
input.forEach((entry) => {
// Create a new object with the key
const newObject = { key: entry.key };
// By default, the parent seems to be "Identification"
let parentKey = "Identification";
// Find out if the parent's name has an underscore?
if (entry.parent.split("__").length > 1) {
// If so, that's the new parent
parentKey = entry.parent.split("__")[0];
}
// If there isn't an array for this parent, make one
if (!transformedObject[parentKey]) {
transformedObject[parentKey] = [];
}
transformedObject[parentKey].push(newObject);
})
const output = [];
// Then we need to shape the data
Object.keys(transformedObject).forEach((parentKey) => {
const parentGroup = {
name: parentKey,
fields: transformedObject[parentKey]
};
output.push(parentGroup);
});
console.log(output);
You'll notice this doesn't get you all the way there. The "id" prefix seems to be merged into the "Identification" prefix, and you want to keep the parent value on some of these objects. You'll need some conditionals or a map or something to get that part working. But I hope this is a start!

JS How to remove an object from array in a forEach loop?

I have a data object with following contents:
{
"content": {
"id": "someID",
"type": "unit",
"method": "xyz",
"blocks": [{
"key": "blue",
"data": [
"Array"
]
}, {
"key": "red",
"data": [
"Array"
]
}, {
"key": "yellow",
"data": [
"Array"
]
}, {
"key": "black",
"data": [
"Array"
]
}],
"notes": "abc"
}
}
I want to remove block that has key yellow, by looping over blocks, rest of the data should be preserved as is. So expected end result would be
{
"content": {
"id": "someID",
"type": "unit",
"method": "xyz",
"blocks": [{
"key": "blue",
"data": [
"Array"
]
}, {
"key": "red",
"data": [
"Array"
]
}, {
"key": "black",
"data": [
"Array"
]
}],
"notes": "abc"
}
}
Data is dynamic so I dont know what would be returned, it might have a match for my condition or it might not.
I've tried a bunch of approaches but nothing seems to have worked so far. I can use lodash too if its any easier. None of those seems to be working. Any help/direction is appreciated
1. Using **delete**
const deleteUnwantedBlock = contentObj => {
const updatedData = contentObj;
const blocks = _.get(updatedData, 'blocks', []);
blocks.forEach(block => {
if (block.key.includes('yellow')) {
delete updatedData.block;
}
});
return updatedData;
};
console.log(deleteUnwantedBlock(data.content));```
2. Using rest operator:
const deleteUnwantedBlock = contentObj => {
const blocks = _.get(contentObj, 'blocks', []);
blocks.forEach(block => {
if (block.key.includes('yellow')) {
let { block, ...restOfTheData } = updatedData;
}
return { ...updatedEntry };
});
};
console.log(deleteUnwantedBlock(data.content));
You just need to filter:
const obj = {
"content": {
"id": "someID",
"type": "unit",
"method": "xyz",
"blocks": [{
"key": "blue",
"data": [
"Array"
]
}, {
"key": "red",
"data": [
"Array"
]
}, {
"key": "yellow",
"data": [
"Array"
]
}, {
"key": "black",
"data": [
"Array"
]
}],
"notes": "abc"
}
};
obj.content.blocks = obj.content.blocks.filter(({ key }) => key !== 'yellow');
console.log(obj);

Search a Javascript Object for the position of a specific ID? [duplicate]

This question already has answers here:
Find by key deep in a nested array
(21 answers)
Closed 4 years ago.
I have a Javascript object with lots of different sections. How can I search through all of the sections to find the position of a specific ID? The ID's that I am searching for are not in a specific location, and can be located in any of the tree branches.
For example, I am searching for this ID:
xobmnbjxg0g_1527269346261
And I am trying to output the position of that ID, which would be this:
app['structure'][0]['if-children'][0]['id']
My Javascript Object:
var app = {
"structure": [
{
"id": "0",
"type":"IF",
"parameters": [
{
"id": "xobmnbjxg0g_1527269346260",
"type": "field",
"value": "CV_TEST_SPOT1X"
},
{
"id": "2",
"type": "operator",
"value": "="
},
{
"id": "3",
"type": "field",
"value": "North America"
}
],
"if-children": [
{
"id": "xobmnbjxg0g_1527269346261",
"type":"IF",
"parameters": [
{
"id": "1",
"type": "field",
"value": "CV_TEST_SPOT1"
},
{
"id": "2",
"type": "operator",
"value": "="
},
{
"id": "3",
"type": "field",
"value": "North America"
}
],
"if-children":[
],
"else-children":[
]
}
],
"else-children":[
{
"id": "xobmnbjxg0g_1527269346262",
"type":"IF",
"parameters": [
{
"id": "1",
"type": "field",
"value": "CV_TEST_SPOT1"
},
{
"id": "2",
"type": "operator",
"value": "="
},
{
"id": "3",
"type": "field",
"value": "North America"
}
],
"if-children":[
{
"id":"xobmnbjxg0g_152726934626X"
}
],
"else-children":[
{
"id":"xobmnbjxg0g_152726934626Y"
}
]
}
]
},
{
"id": "xobmnbjxg0g_1527269346263",
"type":"IF",
"parameters": [
[
{
"id": "1",
"type": "field",
"value": "CV_TEST_SPOT1"
}
]
],
"if-children": [
{
"id": "xobmnbjxg0g_1527269346264",
"type":"IF",
"parameters": [
[
{
"id": "1",
"type": "field",
"value": "CV_TEST_SPOT1"
}
]
],
"if-children":[
{
"id": "xobmnbjxg0g_1527269346265",
"type":"IF",
"parameters": [
{
"id": "1",
"type": "field",
"value": "CV_TEST_SPOT1"
}
],
"if-children":[
{
"id":"xobmnbjxg0g_1527269346266"
}
],
"else-children":[
{
"id":"xobmnbjxg0g_1527269346267"
}
]
}
],
"else-children":[
{
"id":"xobmnbjxg0g_1527269346268"
}
]
}
],
"else-children":[
{
"id":"xobmnbjxg0g_1527269346269"
}
]
}
]
};
Interesting puzzle/question.
pretty sure there are some edge cases im missing but this seems to pass some tests.
function is(obj, type){
return Object.prototype.toString.call(obj) === `[object ${type}]`;
}
function findPosition(obj, mykey, myval, res){
if(is(obj, "Object")){
if(mykey in obj && obj[mykey] === myval){
res.tree.push(mykey);
res.found = true;
} else {
for( let key in obj){
if(res.found) break;
res.tree.push(key);
findPosition(obj[key], mykey, myval, res);
}
if(!res.found) res.tree.pop();
}
} else if(is(obj, "Array")){
for(let i = 0; i < obj.length; i++){
if(res.found) break;
res.tree.push(i);
findPosition(obj[i], mykey, myval, res);
}
if(!res.found) res.tree.pop();
} else {
res.tree.pop();
}
return res;
}
Usage and output
findPosition([{one: { two: [{id: [{id:'my'}]}]}}], "id", "mys", {tree:[], found: false})
> tree: Array(0), found: false}
findPosition([{one: { two: [{id: [{id:'my'}]}]}}], "id", "my", {tree:[], found: false})
> {found: true, tree: [0, "one", "two", 0, "id", 0, "id"]}
For finding if current obj you are iterating over is an Array you can also use Array.isArray

transforming json using recursive function

I'm trying to transform this JSON into array so that I can simply list them as key-value pairs in html. The JSON has nested properties which I want to retain but I want to stringify only those objects that contain "units" and "value". All others should be listed as children items. Please help figure what I'm doing wrong.
Here's the json input:
{
"clusterName": "ml6.engrlab.com-cluster",
"statusProperties": {
"loadProperties": {
"loadDetail": {
"restoreWriteLoad": {
"value": 0,
"units": "sec/sec"
},
},
"totalLoad": {
"value": 0.0825921967625618,
"units": "sec/sec"
}
},
"secure": {
"value": false,
"units": "bool"
},
"statusDetail": {
"licenseKeyOption": [
{
"value": "conversion",
"units": "enum"
},
{
"value": "failover",
"units": "enum"
}
],
"connectPort": 7999,
"softwareVersion": {
"value": 9000100,
"units": "quantity"
}
},
"rateProperties": {
"rateDetail": {
"largeReadRate": {
"value": 0,
"units": "MB/sec"
}
},
"totalRate": {
"value": 67.2446365356445,
"units": "MB/sec"
}
},
"online": {
"value": true,
"units": "bool"
},
"cacheProperties": {
"cacheDetail": {
"tripleCachePartitions": {
"tripleCachePartition": [
{
"partitionSize": 768,
"partitionBusy": 0,
"partitionUsed": 0,
"partitionFree": 100
}
]
}
}
}
}
}
my code
function isNested(obj) {
if(!obj) return false;
let propArry = Object.keys(obj)
for(let i=0; i<propArry.length; i++){
if(obj[propArry[0]].constructor.name === 'Object') return true
}
return false;
}
function getKeyValueAsChildren(obj) {
let vals = [];
for(let key in obj) {
if(obj.hasOwnProperty(key)){
vals.push({key:key, value: obj[key]})
}
}
return vals
}
function valueAsString(obj) {
if(typeof obj !== 'object') return obj;
return `${obj['value']} ${obj['units']}`
}
function getChildren(key, obj) {
if(Object.keys(obj).sort().toString() === "units,value"){
return {key: key, value: valueAsString(obj)}
} else {
return {key: key, children: getKeyValueAsChildren(obj) }
}
}
function getValues(properties, values = []) {
for(let key in properties) {
if(properties.hasOwnProperty(key)) {
let value = properties[key]
if(typeof value !== 'object') {
values.push({key: key, value: value})
} else if(Array.isArray(value)){
let children = []
value.map(v => {
children.push(getChildren(key, v))
})
values.push({key: `${key}List`, children: children})
}
else if(value.constructor.name === 'Object' && isNested(value)){
// I THINK THE MAIN PROBLEM IS HERE
let keys = Object.keys(value)
let children = [];
keys.forEach(key => {
children.push({key: key, children: getValues(value[key])})
})
values.push({key: key, children: children})
}
else {
values.push(getChildren(key, value))
}
}
}
return values
}
getValues(hostProperties)
this returns
[
{
"key": "clusterName",
"value": "ml6.engrlab.com-cluster"
},
{
"key": "statusProperties",
"children": [
{
"key": "loadProperties",
"children": [
{
"key": "loadDetail",
"children": [
{
"key": "restoreWriteLoad",
"children": [
{
"key": "value",
"value": 0
},
{
"key": "units",
"value": "sec/sec"
}
]
}
]
},
{
"key": "totalLoad",
"value": "0.0825921967625618 sec/sec"
}
]
},
{
"key": "secure",
"children": [
{
"key": "value",
"value": false
},
{
"key": "units",
"value": "bool"
}
]
},
{
"key": "statusDetail",
"children": [
{
"key": "licenseKeyOptionList",
"children": [
{
"key": "licenseKeyOption",
"value": "conversion enum"
},
{
"key": "licenseKeyOption",
"value": "failover enum"
}
]
},
{
"key": "connectPort",
"value": 7999
},
]
},
{
"key": "rateProperties",
"children": [
{
"key": "rateDetail",
"children": [
{
"key": "largeReadRate",
"children": [
{
"key": "value",
"value": 0
},
{
"key": "units",
"value": "MB/sec"
}
]
}
]
},
{
"key": "totalRate",
"value": "67.2446365356445 MB/sec"
}
]
},
{
"key": "online",
"children": [
{
"key": "value",
"value": true
},
{
"key": "units",
"value": "bool"
}
]
},
{
"key": "cacheProperties",
"children": [
{
"key": "cacheDetail",
"children": [
{
"key": "tripleCachePartitions",
"children": [
{
"key": "tripleCachePartitionList",
"children": [
{
"key": "tripleCachePartition",
"children": [
{
"key": "partitionSize",
"value": 768
},
{
"key": "partitionBusy",
"value": 0
},
{
"key": "partitionUsed",
"value": 0
},
{
"key": "partitionFree",
"value": 100
}
]
}
]
}
]
}
]
}
]
}
]
}
]
but I need this
[
{
"key": "clusterName",
"value": "ml6.engrlab.com-cluster"
},
{
"key": "statusProperties",
"children": [
{
"key": "loadProperties",
"children": [
{
"key": "loadDetail",
"children": [
{
"key": "restoreWriteLoad",
"value": "0 sec/sec"
}
]
},
{
"key": "totalLoad",
"value": "0.0825921967625618 sec/sec"
}
]
},
{
"key": "secure",
"value": "false bool"
},
{
"key": "statusDetail",
"children": [
{
"key": "licenseKeyOptionList",
"children": [
{
"key": "licenseKeyOption",
"value": "conversion enum"
},
{
"key": "licenseKeyOption",
"value": "failover enum"
}
]
},
{
"key": "connectPort",
"value": 7999
}
]
},
{
"key": "rateProperties",
"children": [
{
"key": "rateDetail",
"children": [
{
"key": "largeReadRate",
"value": "0 MB/sec"
}
]
},
{
"key": "totalRate",
"value": "67.2446365356445 MB/sec"
}
]
},
{
"key": "online",
"value": "true bool"
},
{
"key": "cacheProperties",
"children": [
{
"key": "cacheDetail",
"children": [
{
"key": "tripleCachePartitions",
"children": [
{
"key": "tripleCachePartitionList",
"children": [
{
"key": "tripleCachePartition",
"children": [
{
"key": "partitionSize",
"value": 768
},
{
"key": "partitionBusy",
"value": 0
},
{
"key": "partitionUsed",
"value": 0
},
{
"key": "partitionFree",
"value": 100
}
]
}
]
}
]
}
]
}
]
}
]
}
]
You might have to run more tests, as what you require seems quite arbitrary, but I believe this function does what you are looking for. It works in a similar way to yours, by simply recursing the tree, and checking for object types, and if the special case is matched.
function toKeyValue(obj) {
return Object.keys(obj).map(k => {
var value = obj[k]
var key = k
var valueName = 'children'
if(Array.isArray(value)){
key = k + 'List'
value = value.map(toKeyValue)
}else if(value !== null && typeof value === 'object'){
// check for special case
if(Object.keys(value).sort().toString() === "units,value"){
value = value.value + ' ' + value.units
valueName = 'value'
}else{
value = toKeyValue(value)
}
}else{
valueName = 'value'
}
return {
key: key,
[valueName]: value
}
})
}
Fiddle here

Javascript to manipulate array of objects and create two set of arrays for data and link [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have an object array like the following.
[
{
"name": "car",
"value": "",
"children": [
{
"name": "v8_engine",
"value": "",
"children": [
{
"name": "cylinder-arrangement",
"value": "",
"children": [
{
"name": "type",
"value": "string",
"children": []
},
{
"name": "max-elements",
"value": "8",
"children": []
}
]
}
]
},
{
"name": "other-parts",
"value": "",
"children": [
{
"name": "per-cylinder-parts",
"value": "",
"children": [
{
"name": "piston-diameter",
"value": "",
"children": [
{
"name": "type",
"value": "uint32",
"children": []
},
{
"name": "range",
"value": "2000... 9000",
"children": []
}
]
},
{
"name": "valves",
"value": "",
"children": [
{
"name": "number",
"value": "",
"children": []
},
{
"name": "position",
"value": "",
"children": []
}
]
}
]
}
]
}
]
}
]
I want to parse through each elements and their respective childrens and manipulate it to create two set of arrays
Node data array that contains:key which is index of that element and values as shown
nodeDataArray.push({ key:i,Data: a.yang_type + " " + a.name}) or nodeDataArray.push({ key:i,Data: a.name + " " + a.value})
Link Data array that contains the link (parent child relation ship)
linkDataArray.push({ from: i, to: j });
where i is the index of parent and j is index of child
I have the following function that parses through the elements and pushes them fine in to node data array with index.
vm.tree.forEach(loop);// here vm.tree is the json data, passed dynamically
var i=0;
function loop(a) {
if(a.yang_type!='' && a.name!=''){
nodeDataArray.push({ key:i,Data: a.yang_type + " " + a.name, group: -1 });
//console.log("Data:",a.yang_type);
linkDataArray.push({ from: i, to: i+1 });
}
if(a.name!='' && a.value!=''){
nodeDataArray.push({ key:i,Data: a.name + " " + a.value, group: -1 });
linkDataArray.push({ from: 0, to: i+1 });
}
i=i+1;
// process you data
//if(Array.isArray(a.children)){j++;}
if(Array.isArray(a.children)){
//var g=0;
a.children.forEach(loop);
}
}
Below wordings is based on the sample JSON to make it more clear on what is my expected output should be
parse through the JSON and list out all the elements in the JSON object as shown below
car
v8_engine
cylinder-arrangement
type string
max-elements 8
other_parts
per-cylinder-parts
piston-diameter
type UINT32
range 2000...3000
valves
number
position
Then list of relationship based on parent and child index. Where car is the 0th element,v8_engine is the 2nd and so on … until the last one which is position being 12th
So we have total of 13 elements from the above example. Now I need to list their relation ship too. Like
0th element is parent of 1 and 5.
1st element is parent of 2
2nd element is parent of 3 and 4
and so on
To generate the parent list, you could use a closure with a from variable, which holds the node number from where it has been called.
BTW, your list above is not correct for 5th element is parent of 6 and 10.
function loop(from) {
return function (a) {
var f = i;
if (from !== undefined) {
linkDataArray.push({ from: from, to: i });
}
i++;
if (Array.isArray(a.children)) {
a.children.forEach(loop(f));
}
};
}
var data = [{ "name": "car", "value": "", "children": [{ "name": "v8_engine", "value": "", "children": [{ "name": "cylinder-arrangement", "value": "", "children": [{ "name": "type", "value": "string", "children": [] }, { "name": "max-elements", "value": "8", "children": [] }] }] }, { "name": "other-parts", "value": "", "children": [{ "name": "per-cylinder-parts", "value": "", "children": [{ "name": "piston-diameter", "value": "", "children": [{ "name": "type", "value": "uint32", "children": [] }, { "name": "range", "value": "2000... 9000", "children": [] }] }, { "name": "valves", "value": "", "children": [{ "name": "number", "value": "", "children": [] }, { "name": "position", "value": "", "children": [] }] }] }] }] }],
i = 0,
linkDataArray = [];
data.forEach(loop());
console.log(linkDataArray);
var i=0;
var nodeDataArray = [];
var linkDataArray = [];
function loop(from) {
return function (a) {
var f = i;
if(a.yang_type!='' && a.name!=''){
nodeDataArray.push({ key:i,Data: a.yang_type + " " + a.name, group: -1 });
//c=c+a.name;
//console.log("c:",c);
//console.log("Data:",a.yang_type);
//linkDataArray.push({ from: i, to: i+1 });
}
if(a.name!='' && a.value!=''){
nodeDataArray.push({ key:i,Data: a.name + " " + a.value, group: -1 });
//c=c+a.name+a.value;
console.log("c:",c);
//linkDataArray.push({ from: 0, to: i+1 });
}
if (from !== undefined) {
linkDataArray.push({ from: from, to: i });
}
i++;
if (Array.isArray(a.children)) {
a.children.forEach(loop(f));
}
//console.log("c:",c);
};
}
var data = [{ "name": "car", "value": "", "children": [{ "name": "v8_engine", "value": "", "children": [{ "name": "cylinder-arrangement", "value": "", "children": [{ "name": "type", "value": "string", "children": [] }, { "name": "max-elements", "value": "8", "children": [] }] }] }, { "name": "other-parts", "value": "", "children": [{ "name": "per-cylinder-parts", "value": "", "children": [{ "name": "piston-diameter", "value": "", "children": [{ "name": "type", "value": "uint32", "children": [] }, { "name": "range", "value": "2000... 9000", "children": [] }] }, { "name": "valves", "value": "", "children": [{ "name": "number", "value": "", "children": [] }, { "name": "position", "value": "", "children": [] }] }] }] }] }]
data.forEach(loop());

Categories

Resources