arcpy support for JSON strings

Idea created by eric.eagle on Oct 18, 2018
    • eric.eagle
    • JimLaDOTD

    As far as I'm aware the arcpy.JSONToFeatures_conversion utility only takes a flat file, e.g., your-json-file.json sitting in a directory.


    I would like to suggest that this utility provide support for strings embedded right in one's script instead of having to summon os and mess with paths.  So basically instead of:


    import arcpy

    import os

    file = your_file.json

    path = r"C:\Temp"

    json_file = os.path.join(path, file)

    arcpy.JSONToFeatures(json_fileaaaaahhhhh just makes my head hurt writing it)



    it should be like this:


    import arcpy

    json = { bunch of json/geojson }

    arcpy.JSONToFeatures(json, output)



    Currently, the second approach throws a series of GP errors as it does not appear the tool is set up to handle strings but only files.