There is certainly room for improvement Lrenzo, you could probably
downgrade that exception to a warning for example.

Looking at String toJSONString(SimpleFeature feature)
<https://github.com/geotools/geotools/blob/main/modules/unsupported/geojson/src/main/java/org/geotools/geojson/feature/FeatureJSON.java#L546>
is has:

                Object value = feature.getAttribute(i);

                if (!encodeNullValues && value == null) {
                    // skip
                    continue;
                }

                attributesWritten = true;

Does that answer your question?  It looks like it skips writing null values
when writing json out as a string.

--
Jody Garnett


On Tue, 16 Nov 2021 at 08:05, Lorenzo Di Giacomo <loridi...@gmail.com>
wrote:

> Hi all, i have 2 question:
> 1) what does setEncodeNullValues do? Since i can read a json with null
> values if the field is true or false, so i don't understand what actually
> do.
>
> 2) given a FeatureType, created manually, is there a way to read a JSON
> but taking only the properties declared in the FeatureType and skipping the
> others not declared? Because now, if i dont declare ALL properties that
> existits in the files, it gives me an Exception.
>
> Thank you for your help!!
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to