Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
converting json into ?
#1
I am not a developer, just the guy that is blocked on a project because of this.
I was given an app that is supposed to create a json list. It is then meant to be hit by a url that will create a drop down in Rundeck that fills out build number options from Jenkins. Originally i could not get it to work without throwing a TypeError: the JSON object must be str, not 'bytes' error.  I can get it working in a browser by doing: 

def parseJenkinsJSON(json_text):
    str_response = json_text.readall().decode('utf-8')
    json_data = json.loads(str_response)
but now rundeck will throw Exception: java.lang.Exception: Unexpected content type received: text/html; charset=utf-8. 

How would I convert the json into something that is readable by Rundeck? Per rundeck: Three styles of return data are supported: simple list, simple object, and a name/value list. I need it to be a name/value list, which it is.

Here is an example of the returned json: 
[{"name":" rms-9.06.3_390 #67","value":"http://myurl.com/job/rms-9.06.3_390/67/artifact/application-web/build/libs/rms.war"}]

The whole app is only 70 ish lines, so if it would be more help to see the whole thing I can upload it somewhere.
Reply


Messages In This Thread
converting json into ? - by cmietzner - Aug-16-2017, 07:40 PM
RE: converting json into ? - by nilamo - Aug-16-2017, 08:00 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020