I am having trouble converting some JSON and I will help. This is my problem, I got the following JSON:
Example of received JSON (from CSV file):
[
{
"rating": "0",
"title": "The Killing Kind",
"author": "John Connolly",
"type": "Book",
"asin": "0340771224",
"tags": "",
"review": "i still haven't had time to read this one..."
},
{
"rating": "0",
"title": "The Third Secret",
"author": "Steve Berry",
"type": "Book",
"asin": "0340899263",
"tags": "",
"review": "need to find time to read this book"
},
cut for brevity
]
Now, this is a one-dimensional array of objects, but I have a function that I need to pass to this will ONLY accept a multidimensional array. I can not do anything. I was browsing web pages for conversion and came across this code:
if (! obj.length) { return [];}
var a = [];
try {
a = Array.prototype.slice.call(obj, n);
}
catch(e) {
Core.batch(obj, function(o, i) {
if (n <= i) {
a[i - n] = o;
}
});
}
return a;
But my code continues to get stuck in the "no object length" part. When I repeat every object, I get a character by character. Unfortunately, these field names (rating, title, author), etc. Not set in stone, and I cannot access anything using the obj.Field notation.
; JSON?