Skip to content

Camel route to transform a json input in a different json data structure

Notifications You must be signed in to change notification settings

rruizher/json-ngis-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

json-ngis-json

Camel route to transform a json input in a different json data structure. It uses 2 unmarshallers from Jackson library and a custom Camel processor to adapt from a POJO to another POJO and then in final JSON file.

alt tag

To use clone the repository and mvn camel:run

Transforms from:

  { 
	"number":233,
	"name":"233_SAN_JUAN_BOSCO_SANTIAGO_RUSIÑOL",
	"address":"San Juan Bosco - Santiago Rusiñol",	
	"banking":true,
	"bonus":false,
	"status":"OPEN",
	"contract_name":"Valence",
	"bike_stands":15,
	"available_bike_stands":1,
	"available_bikes":11,
	"last_update":1436397064000
  }

To:

  {
	"contextElements": [
		{
			"type": "Station",
			"isPattern": "false",
			"id": "233_SAN_JUAN_BOSCO_SANTIAGO_RUSIÑOL",
			"attributes": [
			{
				"name": "number",
				"type": "integer",
				"value": "233"
			},
			{
				"name": "name",
				"type": "string",
				"value": "233_SAN_JUAN_BOSCO_SANTIAGO_RUSIÑOL"
			},
			{
				"name": "address",
				"type": "string",
				"value": "San Juan Bosco - Santiago Rusiñol"
			},
			{
				"name": "banking",
				"type": "boolean",
				"value": "true"
			},
			{
				"name": "bonus",
				"type": "boolean",
				"value": "false"
			},
			{
				"name": "status",
				"type": "string",
				"value": "OPEN"
			},
			{
				"name": "contract_name",
				"type": "string",
				"value": "Valence"
			},
			{
				"name": "bike_stands",
				"type": "integer",
				"value": "15"
			},
			{
				"name": "available_bike_stands",
				"type": "integer",
				"value": "4"
			},
			{
				"name": "available_bikes",
				"type": "integer",
				"value": "11"
			},
			{
				"name": "last_update",
				"type": "string",
				"value": "1436397064000d"
			}
		    ]
		}
	],
	"updateAction": "APPEND"
  }

About

Camel route to transform a json input in a different json data structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages