W
W
WoodWold2021-10-25 16:09:50
JavaScript
WoodWold, 2021-10-25 16:09:50

How to change curly brackets to square brackets in JSON?

Hello everyone, one system returns JSON with curly brackets where square brackets should be:

{
{
         "title": "Название",
         "description": "Описание"
    }, {
        "title": "Второе название",
        "description": "Второе описание"
}

{
   "tile":"Название",
   "description":{"1","2"}
}


Maybe you know a ready-made solution in Java, JS that would change curly brackets to square ones where necessary (when specifying arrays)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2021-10-25
@Aleksandr-JS-Developer

Maybe you know a ready-made solution in Java, JS

There is no such solution. Please contact the author of the system. She just can't be big.
Sawing a parser in your situation is an extremely stupid idea, leave it for last.
UPD : If you still want to write a parser, then here's a source of inspiration for you:
JSFiddle

A
Aetae, 2021-10-25
@Aetae

There are no ready ones, because it is not even close to the standard. You'll have to cut your parser. Or fix the system.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question