JQuery "Unrecognized expression" for JSON


I have a jstree plugin which I am trying to pass data from a Java servlet. I am using JQuery 1.10.2.

My javascript:

                    "core" : {
                      'data' : {
                        'url' : function (node) {
                            return node.id === '#' ?
                              '../MediaServletTree' : '../MediaServletTree';
                              //'ajax_demo_children.json' : 'ajax_demo_children.json';
                        'data' : function (node) {
                          return {
                              'id' : node.id

My code in Java for MediaServletTree:

JSONObject jsonObj = new JSONObject();
jsonObj.put("id", "demo_child_1");
jsonObj.put("text", "Child 1");

which results in:

{“id”:“demo_child_1”,“text”:“Child 1”}

If I use Java’s ‘MediaServletTree’, I get ‘Uncaught Error: Syntax error, unrecognized expression: {“id”:“demo_child_1”,“text”:“Child 1”}’.

If I copy the JSON and put inside a text file and run ajax_demo_children.json. No problem.

How to I resolve unrecognized expression?

Please help. Thanks.

Found the error: set this in Java: