Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57940

readJSON from pipeline-utility-steps-plugin swallows keys named 'class'

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None

    Description

      The readJSON step does not return any key named 'class'

      For example:

      input = '{"class":"example","other":"value"}'
      echo "${input}"
      output = readJSON text: input
      echo "${output}"
      

      Returns:

      [Pipeline] Start of Pipeline
      [Pipeline] echo
      {"class":"example","other":"value"}
      [Pipeline] readJSON
      [Pipeline] echo
      [other:value]
      [Pipeline] End of Pipeline
      

      Is this a reserved keyword? 

      Attachments

        Activity

          gruemaster Tobin Davis added a comment -

          Apparently this is because Jenkins uses a patched json-lib to remove "class", "declaringClass", and "metaClass" from json files.  See https://github.com/jenkinsci/json-lib/blob/16052d1f74908fb59430eddd73f42aec2469b313/src/main/java/net/sf/json/JsonConfig.java#L49.

          gruemaster Tobin Davis added a comment - Apparently this is because Jenkins uses a patched json-lib to remove "class", "declaringClass", and "metaClass" from json files.  See  https://github.com/jenkinsci/json-lib/blob/16052d1f74908fb59430eddd73f42aec2469b313/src/main/java/net/sf/json/JsonConfig.java#L49 .

          People

            rsandell rsandell
            idriver Ian Driver
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: