arcpy has:


which can handle feature layers, but what about file geodatabase tables?

Not too hard to implement custom, but I want something with the same API as FeaturesToJSON and will be maintained by Esri as updates are made. Here is a custom solution, but I don't like it:

def feature_table_to_json(tablePath, fields='*'):
    rows = []
    with arcpy.da.SearchCursor(tablePath, field_names=fields) as cursor:
        print cursor.fields
        colnames = cursor.fields
        for row in cursor:
            rows.append(dict(zip(colnames, row)))
    date_converter = lambda r: r.isoformat() if isinstance(r, datetime.datetime) else None
    result = {}
    result['features'] = rows
    return json.dumps(result, default=date_converter)

1 Answer 1


Sort of, but the final JSON have to be small enough fit in memory (though your sample script has that same restriction). The RecordSet object has a .JSON property so you can roll your own that way too:

r = RecordSet(tablePath)
with open('out.json', 'w') as out_file:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.