Metadata-Version: 1.1
Name: json-mapper
Version: 0.1.5
Summary: Map and parse JSON text to python dict
Home-page: https://github.com/SevenQuark/json-mapper
Author: SevenQuark
Author-email: info@sevenquark.com
License: BSD
Description: # Usage example
        
        Suppose we have such a terrible JSON dump:
        
        ```python
            {
                "ApiResponse": {
                    "ApiResponseWrapper": {
                        "HotelsResponse": [
                            {
                                "Country": "Russia", 
                                "HotelId": "1234", 
                                "HotelName": "Space Hotel", 
                                "Photos": [
                                    {
                                        "BigUrl": "http://www.image.url.com", 
                                        "ThumbnailUrl": "http://www.image.url.com"
                                    }, 
                                    ... other photos ...
                                ], 
                                "RoomsResponse": [
                                    {
                                        "BedsCount": "1", 
                                        "RoomId": "12312"
                                    }, 
                                    ... other rooms ...
                                ]
                            }, 
                            ... other hotels ...
                        ], 
                        "ResponseTimestamp": "2342423423423423", 
                        "SessionId": "0ABAA840-F6EC-6913-A1C2-7341899060B6"
                    },
                    "SomeProperty": "SomeData"
                }
            }
        ``` 
        
        Example to map the his pretty:
        
        ```python
            import json
            from json_mapper.mapper import map_json
        
            json_data = json.loads(open('dump.json').read())
        
            mapping_config = {
                'ApiResponse.ApiResponseWrapper': {
                    'ResponseTimestamp': 'last_update',
        
                    '{loop=>hotels} HotelsResponse': {
                        'HotelId':  'id',
                        'Country':  'country',
        
                        '{loop=>photos} Photos': 'BigUrl',
        
                        '{loop=>rooms} RoomsResponse': {
                            'RoomId':       'id',
                            'BedsCount':    'beds'
                        }
                    }
                }
            }
        
            result = map_json(mapping_config, json_data)
        
            >>> pprint(result)
            {'hotels': [{'country': u'Russia',
                         'id': u'1234',
                         'photos': [u'http://www.image.url.com',
                                    u'http://www.image.url.com'],
                         'rooms': [{'beds': u'1', 'id': u'12312'},
                                   {'beds': u'1', 'id': u'12312'}]},
                        {'country': u'Russia',
                         'id': u'1234',
                         'photos': [u'http://www.image.url.com',
                                    u'http://www.image.url.com'],
                         'rooms': [{'beds': u'1', 'id': u'12312'},
                                   {'beds': u'1', 'id': u'12312'}]}],
             'last_update': u'2342423423423423'}
         ```
        
         See full example in tests directory.
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: Software Development :: Object Brokering
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: Implementation :: Jython
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
