conveyal / gtfs-editor

A web-based GTFS editing framework. THIS PROJECT IS DEPRECATED. See https://github.com/ibi-group/datatools-ui for current version.
https://github.com/ibi-group/datatools-ui
MIT License
134 stars 63 forks source link

JSON deserialize problem with TripPattern #229

Open angelsephirot opened 9 years ago

angelsephirot commented 9 years ago

JACKSON do not handle correclty the inner List in TripPattern class Here is a quick way to resolve the problem in TripPatternController

tripPattern = Base.mapper.readValue(params.get("body"), TripPattern.class);
            // Read the response as a tree model
            final JsonNode response = Base.mapper.readTree(params.get("body")).path("patternStops");

            final CollectionType collectionType =
                    TypeFactory
                            .defaultInstance()
                            .constructCollectionType(List.class, TripPatternStop.class);

            // Convert the tree model to the collection (of Author-objects)
            tripPattern.patternStops = Base.mapper.reader(collectionType).readValue(response);