Rhino: return JSON from within Java

后端 未结 3 1910
青春惊慌失措
青春惊慌失措 2021-01-22 08:51

I have the string representation of a JSON-serialized object in Java e.g. \"{\\\"name\\\":\\\"John\\\",\\\"age\\\":24}\". How do I parse and return it to the JavaSc

3条回答
  •  花落未央
    2021-01-22 09:51

    Found the answer here: Access Rhino's native JSON.Stringify from Java

    import org.mozilla.javascript.NativeJSON;
    
    Object json = NativeJSON.parse(cx, scope, str, null, null);
    

提交回复
热议问题