JSON array or JSON object?
Hello everyone,
i already asked this question in another post (https://community.intersystems.com/post/how-can-i-import-my-json-formatt...) and i'm sorry for creating a new post but i still didn't get an answer so i try it again. Now i know how to import my JSON formatted data from my API to my DocDB but now i have the problem that my JSON formatted data from my API is imported only to the %Doc column and not to the columns that i created with my properties. I'm not really sure but i think that the document database only puts my information from my API to the right columns if my JSON is in a JSONArrray format. But the format of my API is JSONObject and looks like this:
{
"artists": {
"artist": [
{
"name": "Tough Love",
"playcount": "279426",
"listeners": "58179",
"mbid": "d07276bc-3874-4deb-8699-35c9948be0cc",
"url": "https://www.last.fm/music/Tough+Love",
"streamable": "0",
"image": [
{
"#text": "https://lastfm-img2.akamaized.net/i/u/34s/3fa24f60a855fdade245138dead7ec...",
"size": "small"
},
{
"#text": "https://lastfm-img2.akamaized.net/i/u/64s/3fa24f60a855fdade245138dead7ec...",
"size": "medium"
},
{
"#text": "https://lastfm-img2.akamaized.net/i/u/174s/3fa24f60a855fdade245138dead7e...",
"size": "large"
},
{
"#text": "https://lastfm-img2.akamaized.net/i/u/300x300/3fa24f60a855fdade245138dea...",
"size": "extralarge"
},
{
"#text": "https://lastfm-img2.akamaized.net/i/u/300x300/3fa24f60a855fdade245138dea...",
"size": "mega"
}
]
Is there a possibility to convert the format from JSONObject to JSONArray or do i have to parse it? I want to import only the body from my API with "name", "playcount", "listeners" and so on as my headers without "artists" and without "artist". I just want to leave off the first two headers.
Thank you in advance.