Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8157160

JSON.stringify does not work on ScriptObjectMirror objects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • core-libs
    • None
    • b120
    • generic
    • generic

    Backports

      Description

        When JSON.stringify is called on a ScriptObjectMirror, we get undefined value. JSON.stringify is used as debug aid by nashorn users. ScriptObjectMirror being not handled by JSON.stringify makes it difficult.

        D:\src\jdk9-dev\build\windows-x86_64-normal-server-release\images\jdk\bin>.\jjs
        jjs> SM = javax.script.ScriptEngineManager
        [JavaClass javax.script.ScriptEngineManager]
        jjs> e = new SM().getEngineByName("nashorn")
        jdk.nashorn.api.scripting.NashornScriptEngine@23348b5d
        jjs> JSON.stringify(e.eval("({ foo: 343 })")) === undefined
        true
        jjs>

        This issue was reported by Eric Pederson via nashorn-dev alias.

        See also: http://mail.openjdk.java.net/pipermail/nashorn-dev/2016-May/006162.html

        Attachments

          Issue Links

            Activity

              People

                sundar Sundararajan Athijegannathan
                sundar Sundararajan Athijegannathan
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: