Created
January 21, 2019 03:06
-
-
Save chaosx/e03e0c4bb4edc6357532462830d4721d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # author: Arpegius | |
| # link: https://stackoverflow.com/users/142039/arpegius | |
| import json | |
| class JSONObject: | |
| def __init__( self, dict ): | |
| vars(self).update( dict ) | |
| #this is valid json string | |
| data='{"channel":{"lastBuild":"2013-11-12", "component":["test1", "test2"]}}' | |
| jsonobject = json.loads( data, object_hook= JSONObject) | |
| print( jsonobject.channel.component[0] ) | |
| print( jsonobject.channel.lastBuild ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment