Question

Json to features

  • 17 June 2014
  • 7 replies
  • 12 views

Badge
Dear All , 

 

 

I use geometry replace to convert json to feature , but it doesn't work it give an error , I tried geojson and esrijson both give an error , below is the json text which stored in a feature class . 

 

 

{

 

    "geometryType": "esriGeometryPolygon",

 

    "hasZ": false,

 

    "hasM": false,

 

    "features": [

 

        {

 

            "geometry": {

 

                "rings": [

 

                    [

 

                        [

 

                            6055422.478793681,

 

                            2809493.0711957584

 

                        ],

 

                        [

 

                            6055818.269231402,

 

                            2809235.807411239

 

                        ],

 

                        [

 

                            6055646.760041723,

 

                            2808978.5436267196

 

                        ],

 

                        [

 

                            6055293.8469014205,

 

                            2808998.333148606

 

                        ],

 

                        [

 

                            6055211.390560228,

 

                            2809206.12312841

 

                        ],

 

                        [

 

                            6055422.478793681,

 

                            2809493.0711957584

 

                        ]

 

                    ]

 

                ]

 

            },

 

            "attributes": {

 

                "GraphicType": "ProposedPlot",

 

                "IsSaved": "False"

 

            }

 

        }

 

    ]

 

}

7 replies

Badge +3
Hi,

 

 

I copied your json adn paste it to a txt file. I read it with esrijson and get a 5 sided ploygon...no errors.

 

How have u stored this json object?
Badge
Thanks GIO , We are storing the features in to SQL server within ntext attribute 
Badge +3
I read that ntext is a single variable length string.

 

I made it one string and removed all spaces. It still works fine.

 

 

 

Maybe one or more json objects have a character count wich is too long for the field written too?

 

(i understand that the format definition is written ntext(n) where n is legth)

 

You could do a character count to see wath max. legth is of json objects.

 

 

You could go for nvarchar instead of ntext? Wich is what everyone advises.

 

ntext seems to be a depricated format btw.
Badge +3
Hi,

 

 

you can use this to count characters

 

use a creator to make

 

char_count = @Evaluate([llength [split @Value(col0) {}]])

 

Badge
Hi , 

 

 

It is not a problem of charcter length , I tried it for the record I sent and still I am getting an error . Thanks , 
Userlevel 2
Badge +17
Hi,

 

 

I myself have no practical experience on JSON, but possibly the JSONFragmenter transformer with this query helps you to extract geometry objects from the full JSON document.

 

-----

 

JSON Query: json["features"][*]["geometry"]

 

-----

 

 

Takashi
Badge +3
Then maybe a faulty object (json incorrect) is in the dataset?

 

 

The only way i get it to yield an error is by remoinge somee brace, bracket or other punctuation mark so it can't parse it no more...

Reply