AnsweredAssumed Answered

JSONToFeatures_conversion:  Cannot create a table with a duplicate column

Question asked by ekv5_cdc on Aug 16, 2017
Latest reply on Aug 18, 2017 by ekv5_cdc

Hi,

 

I'm working on a Python script that bulk downloads layers from feature servers.  I download each layer as JSON and then use JSONToFeatures_conversion to convert it to a feature class.  The script works okay for the most part, but for some reason about a quarter of the layers fail to convert from JSON to Feature Class.

 

I consistently receive an Error 206: Cannot create FeatureClass, and it further elaborates that I "cannot create a table with a duplicate column."  While that makes sense, this seems odd to me because I'm basically copying valid layers, not adding any columns, and there shouldn't be any duplicate columns.  I've also manually converted individual layers using the same workflow just to see if it was a data issue, and I'm able to create feature classes with no problem.

 

Could someone give me a hint as to what I may be doing wrong?

 

Here's how I'm writing my JSON if it helps:

def write_json(url_response):
    """Writes JSON to a file."""
    with open('downloadFile.json', 'wb') as chunkTemp:
        for chunk in url_response.iter_content(chunk_size=1024):
            if chunk:
                try:
                    chunkTemp.write(chunk)
                except Exception as e:
                    print 'Yuck. ' + str(e)
                    break
        chunkTemp.seek(0) #Go back to the top of the file.
    return chunkTemp

 

If it's not obvious, I'm a relative novice with Python and a complete noob when it comes to working with JSON.

 

Thanks.

Outcomes