P
P
PrimaryWeb2018-10-07 19:47:48
JSON
PrimaryWeb, 2018-10-07 19:47:48

How to make normal json out of this?

Like from this:
"{\n \"kind\": \"youtube#channelListResponse\",\n \"etag\": \"\\\"XI7nbFXulYBIpL0ayR_gDh3eu1k/hIueXgPmakbtLpTce1vH2iag7E\\\"\",\n \" pageInfo\": {\n \"totalResults\": 1,\n \"resultsPerPage\": 1\n },\n \"items\": [\n {\n \"kind\": \" youtube#channel\",\n \"etag\": \"\\\"XI7nbFXulYBIpL0ayR_gDh3eu1k/lU3QKvcJcmvCWjZFRd9zvMilEqk\\\"\",\n \"id\": \"UCRBk-5H9PZ6RHLY92-dd9jA\",\n \"statistics\": {\n \"viewCount\": \"992\",\n \"commentCount\": \"0\",\n \"subscriberCount\": \"55\",\ n \"hiddenSubscriberCount\": false,\n \"videoCount\": \"6\"\n }\n }\n ]\n}\n"
Do this:
{
"kind": "youtube#channelListResponse",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/hIueXgPmakbtLpTce1vH2iag7E\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/lU3QKvcJcmvCWjZFRd9zvMilEqk\"",
"id": "UCRBk- 5H9PZ6RHLY92-dd9jA",
"statistics": {
"viewCount": "992",
"commentCount": "0",
"subscriberCount": "55",
"hiddenSubscriberCount": false,
"videoCount": "6"
}
}
]
}
This is the same array

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2018-10-07
@Taraflex

console.log(JSON.stringify(JSON.parse("{\n \"kind\": \"youtube#channelListResponse\",\n \"etag\": \"\\\"XI7nbFXulYBIpL0ayR_gDh3eu1k/hIueXgPmakbtLpTce1vH2igag7E\\\"\",\n \"pageInfo\": {\n \"totalResults\": 1,\n \"resultsPerPage\": 1\n },\n \"items\": [\n {\n \"kind\": \"youtube#channel\",\n \"etag\": \"\\\"XI7nbFXulYBIpL0ayR_gDh3eu1k/lU3QKvcJcmvCWjZFRd9zvMilEqk\\\"\",\n \"id\": \"UCRBk-5H9PZ6RHLY92-dd9jA\",\n \"statistics\": {\n \"viewCount\": \"992\",\n \"commentCount\": \"0\",\n \"subscriberCount\": \"55\",\n \"hiddenSubscriberCount\": false,\n \"videoCount\": \"6\"\n }\n }\n ]\n}\n"), null, "    "))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question