Creating SQL Views via RESTConfig as JSON fails

Description

Goal: Create a SQL View via REST config, using the JSON API format.

Problem: org.geoserver.config.util.XStreamPersister.VirtualTableConverter.unmarshal() parses the JSON for the virtual-table declaration in the POST in a sequence-specific way. This is fine for XML, but the equivalent JSON uses an object, which is meant to be unordered as per the http://www.ietf.org/rfc/rfc4627 - JSON RFC. Depending on the language/library generating the JSON, it can be really hard to get it in a defined order (and it's not obvious that's the problem... errors are about missing keys).

Example:
POST to: http://localhost:8080/geoserver/rest/workspaces/my/datastores/my_database/featuretypes.json - http://localhost:8080/geoserver/rest/workspaces/my/datastores/my_database/featuretypes.json

Not working:

Working (magic sequence order):

Environment

None

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

Affects versions

Components

Priority

Medium
Configure