Skip to content

Duplicate properties in the JSON cause a dictionary duplicate Key error #1

Description

@sbland

If there are multiple property keys with the same name i.e.:
"properties": {
"id": 1,
"lyr": "CityVerveBorderb-6yknyc",
"id": "1"
}
Unity will throw a error.

Can be resolved by updating parseProperties() in FeatureObject.cs to the following:

protected void parseProperties(JSONObject jsonObject) { for(int i = 0; i < jsonObject.list.Count; i++){ string key = (string)jsonObject.keys[i]; JSONObject value = (JSONObject)jsonObject.list[i]; try { properties.Add(key, value.str); } catch { Debug.LogWarning("Duplicate Key: " + key + " in properties"); } } }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions