cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

Make the JSON formatting function JSONFormat.IndentFour accept standard JSON

When I tried to use the JSON function JSONFormat.IndentFour to format JSON text I found it has a limitation that is peculiar to say the least.

When you read in standard JSON the formatting doesn't work.

Set(  FormattedJSON , JSON(  JSONinput  , JSONFormat.IndentFour ))

I found out it requires me to strip off the quotes around field names.

Why is that?

 

So this wrong:

 

{
    "id": "/providers/Microsoft.Flow/",
    "name": "c43187c3-3693-4ac9-844f-08dfefd8f09d",
    "test": {
        "p": "p",
        "q": "q",
        "r": "r"
    }
}

 

This is right:

 

{
    name:"c43187c3-3693-4ac9-844f-08dfefd8f09d",
    id:"/providers/Microsoft.Flow/",
    test:{
        p:"p", 
        q:"q", 
        r:"r"
    }
}

 

And then when it finally formats the JSON correctly with the proper indenting, it puts these quotes back on.

Giving the result, it will not accept as input!

That is weird.

Status: New