jdk.nashorn.internal.parser.JSONParser Java Examples
The following examples show how to use
jdk.nashorn.internal.parser.JSONParser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JSONFunctions.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); final boolean dualFields = ((ScriptObject) global).useDualFields(); final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { value = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } return applyReviver(global, value, reviver); }
Example #2
Source File: JSONFunctions.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final JSONParser parser = new JSONParser( new Source("<json>", str), new Context.ThrowErrorManager()); Node node; try { node = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } final ScriptObject global = Context.getGlobalTrusted(); Object unfiltered = convertNode(global, node); return applyReviver(global, unfiltered, reviver); }
Example #3
Source File: JSONFunctions.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); final boolean dualFields = ((ScriptObject) global).useDualFields(); final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { value = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } return applyReviver(global, value, reviver); }
Example #4
Source File: JSONFunctions.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); final boolean dualFields = ((ScriptObject) global).useDualFields(); final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { value = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } return applyReviver(global, value, reviver); }
Example #5
Source File: JSONFunctions.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final JSONParser parser = new JSONParser( new Source("<json>", str), new Context.ThrowErrorManager()); Node node; try { node = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } final ScriptObject global = Context.getGlobalTrusted(); Object unfiltered = convertNode(global, node); return applyReviver(global, unfiltered, reviver); }
Example #6
Source File: JSONFunctions.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); final boolean dualFields = ((ScriptObject) global).useDualFields(); final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { value = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } return applyReviver(global, value, reviver); }
Example #7
Source File: JSONFunctions.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final JSONParser parser = new JSONParser( new Source("<json>", str), new Context.ThrowErrorManager()); Node node; try { node = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } final ScriptObject global = Context.getGlobalTrusted(); Object unfiltered = convertNode(global, node); return applyReviver(global, unfiltered, reviver); }
Example #8
Source File: JSONFunctions.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); final boolean dualFields = ((ScriptObject) global).useDualFields(); final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { value = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } return applyReviver(global, value, reviver); }
Example #9
Source File: JSONFunctions.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); final boolean dualFields = ((ScriptObject) global).useDualFields(); final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { value = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } return applyReviver(global, value, reviver); }
Example #10
Source File: JSONFunctions.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Parses the given JSON text string and returns object representation. * * @param text JSON text to be parsed * @param reviver optional value: function that takes two parameters (key, value) * @return Object representation of JSON text given */ public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); final boolean dualFields = ((ScriptObject) global).useDualFields(); final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { value = parser.parse(); } catch (final ParserException e) { throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage()); } return applyReviver(global, value, reviver); }
Example #11
Source File: JSONWriter.java From nashorn with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #12
Source File: JSONWriter.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #13
Source File: JSONWriter.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #14
Source File: JSONWriter.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #15
Source File: JSONWriter.java From hottub with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #16
Source File: JSONWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #17
Source File: JSONWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #18
Source File: JSONWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #19
Source File: JSONWriter.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #20
Source File: JSONWriter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static String quote(final String str) { return JSONParser.quote(str); }
Example #21
Source File: JSONFunctions.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #22
Source File: JSONFunctions.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #23
Source File: JSONFunctions.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #24
Source File: JSONFunctions.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #25
Source File: JSONFunctions.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #26
Source File: JSONFunctions.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #27
Source File: JSONFunctions.java From jdk8u_nashorn with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #28
Source File: JSONFunctions.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #29
Source File: JSONFunctions.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }
Example #30
Source File: JSONFunctions.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * Returns JSON-compatible quoted version of the given string. * * @param str String to be quoted * @return JSON-compatible quoted string */ public static String quote(final String str) { return JSONParser.quote(str); }