Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install d9t.json

How to install d9t.json

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install d9t.json
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.4 Available View build log
Windows (64-bit)
0.4 Available View build log
Mac OS X (10.5+)
0.4 Available View build log
Linux (32-bit)
0.4 Available View build log
Linux (64-bit)
0.4 Available View build log
 
License
GPLv3
Dependencies
Depended by
Imports
Lastest release
version 0.4 on Jan 5th, 2011

Introduction

This is a json parser. It understands everything within brackets. That means, you will give it anything like

{'activePolygonId':null,'polygons':null,'route':null}

Of course deeply nested arrays are fully supported without a limit.

d9t.json

>>> from d9t.json import parser

Let's define some json data.

>>> json = """ {'data1':null, 'data2':'something', 'data3':[-1.42,2,-3,.34,-.55',string',true,{'datanested':'something','floatdata':44.22, 'bool':false}]} """
>>> domparser = parser.JsDomParser(json)
>>> data = domparser.parse()
>>> sorted(data.keys())
['data1', 'data2', 'data3']
>>> data["data1"] is None
True
>>> data["data2"]
'something'
>>> len(data['data3'])
8
>>> data['data3'][0] == -1.42
True
>>> data['data3'][1] == 2
True
>>> data['data3'][2] == -3
True
>>> data['data3'][3] == .34
True
>>> data['data3'][4] == -0.55
True
>>> data['data3'][5] == ',string'
True
>>> data['data3'][6] == True
True
>>> sorted(data['data3'][7].keys())
['bool', 'datanested', 'floatdata']
>>> data['data3'][7]['bool'] == False
True
>>> data['data3'][7]['floatdata'] == 44.22
True
>>> data['data3'][7]['datanested'] == 'something'
True

That's it ;)

Changelog

0.4 - Bugfix release [20090622 - Daniel Kraft]

  • Negative Integers, negative Floats and floats with a "."-start were not

System Message: WARNING/2 (<string>, line 100)

Bullet list ends without a blank line; unexpected unindent.

parsed correctly. Thanks Kevin Oberlies.

0.3* - splitted off from google.directions [Daniel Kraft]


  • Initial release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.