B4J Question JSON generator return unqoted string?

tchart

Well-Known Member
Licensed User
Longtime User
Hi All,

I trying to use JSON generator to return a JSON to be used in some javascript code. e.g.
{name: "Item 1",
type: Tree.FOLDER}

However Tree.FOLDER returns as "Tree.FOLDER" which is not working.

Is there a way to esacpe this from being quoted?

Thanks
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
A JSON object must contain JSON variables. There are six types : strings; numbers; Booleans; arrays; JSON objects; null. Which of these is Tree.FOLDER? I suspect that it is a variable and it is the content of that variable, probably a string, that you should be putting into the JSON generator. At the moment the JSON generator is trying to help you out by making a best guess.
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
Thanks, Im familar with JSON.

In the JavaScript library Im using Tree.FOLDER is an object, which is why I would like to avoid putting it in quotes. As a work around Ive altered the JavaScript library to check a string literal instead of just testing against the Tree.FOLDER object.

As per my original question I was just asking if there was a way to add unquoted text in JSON generator.
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
Thanks Erel, I was doing that initially but I have decided to alter the JavaScript library to work with a string.
 
Upvote 0
Top