Unity-GeoJSONObject icon indicating copy to clipboard operation
Unity-GeoJSONObject copied to clipboard

Duplicate properties in the JSON cause a dictionary duplicate Key error

Open sbland opened this issue 8 years ago • 1 comments

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"); } } }

sbland avatar Aug 20 '17 12:08 sbland

Thanks, that's a good point! I'll take a look and fix that.

Regards, Timo

timokorkalainen avatar Oct 26 '17 18:10 timokorkalainen