While parsing a JSON object, is there any better way to convert all single length objects to array, because when I want to run a loop using length it works well for arrays but fail if length is 1 and it is an object (not included in []).
module:{section:{topic:"some topic"}, section:{[{topic:"some topic1"},{topic:"some topic2"},{topic:"some topic3"}]}}
My question is module.section.length is good for second section but undefined for first section. So is there any way to convert all objects inside JSON into arrays?