When extracting data from the database using Sveltekit and Node.js, I always fetch data in the following way:
...
responseData = await response.json();
The retrieved data is an Object, which can be assigned to an array like this:
let getData = [];
getData = responseData ;
I find it confusing that when the returned JSON Object is displayed in the console, it shows brackets indicating an array (though when checked with typeof, it is classified as an Object):
[
{a:1,b:1},
{a:2,b:2},
]
I would expect a JSON Object to look like this:
{"name":"John", "age":30, "car":null}
and why can a JSON Object be directly assigned to an array?
It seems like there might be some misunderstanding about these data types on my end.