def fromJSON(jsonValue):
        """returns a featureset from a JSON string"""
        jd = json.loads(jsonValue)
        features = []
        if 'fields' in jd:
            fields = jd['fields']
        else:
            fields = {'fields':[]}
        if 'features' in jd:
            for feat in jd['features']:
                wkid = None
                spatialReference =None
                if 'spatialReference' in jd:
                    spatialReference = jd['spatialReference']
                    if 'wkid' in jd['spatialReference']:
                        wkid = jd['spatialReference']['wkid']
                    elif 'latestWkid' in jd['spatialReference']: # kept for compatibility
                        wkid = jd['spatialReference']['latestWkid']
                features.append(Feature(json_string=feat, wkid=wkid, spatialReference=spatialReference))
        return FeatureSet(fields,
                          features,
                          hasZ=jd['hasZ'] if 'hasZ' in jd else False,
                          hasM=jd['hasM'] if 'hasM' in jd else False,
                          geometryType=jd['geometryType'] if 'geometryType' in jd else None,
                          objectIdFieldName=jd['objectIdFieldName'] if 'objectIdFieldName' in jd else None,
                          globalIdFieldName=jd['globalIdFieldName'] if 'globalIdFieldName' in jd else None,
                          displayFieldName=jd['displayFieldName'] if 'displayFieldName' in jd else None,
                          spatialReference=jd['spatialReference'] if 'spatialReference' in jd else None)
def fromJSON ( jsonValue ) : jd = json . loads ( jsonValue ) features = [ ] if 'fields' in jd : fields = jd [ 'fields' ] else : fields = { 'fields' : [ ] } if 'features' in jd : for feat in jd [ 'features' ] : wkid = None spatialReference = None if 'spatialReference' in jd : spatialReference = jd [ 'spatialReference' ] if 'wkid' in jd [ 'spatialReference' ] : wkid = jd [ 'spatialReference' ] [ 'wkid' ] elif 'latestWkid' in jd [ 'spatialReference' ] : wkid = jd [ 'spatialReference' ] [ 'latestWkid' ] features . append ( Feature ( json_string = feat , wkid = wkid , spatialReference = spatialReference ) ) return FeatureSet ( fields , features , hasZ = jd [ 'hasZ' ] if 'hasZ' in jd else False , hasM = jd [ 'hasM' ] if 'hasM' in jd else False , geometryType = jd [ 'geometryType' ] if 'geometryType' in jd else None , objectIdFieldName = jd [ 'objectIdFieldName' ] if 'objectIdFieldName' in jd else None , globalIdFieldName = jd [ 'globalIdFieldName' ] if 'globalIdFieldName' in jd else None , displayFieldName = jd [ 'displayFieldName' ] if 'displayFieldName' in jd else None , spatialReference = jd [ 'spatialReference' ] if 'spatialReference' in jd else None )
returns a featureset from a JSON string