Map one JSON schema to a different JSON schema

Viewed 8565

I have a bunch of JSON files, thousands of different schemas. Using GenSON (the Python JSON schema generator), I managed to create schema files for each of the input files. Now, what I'd like to do is standardize all these different files to one defined schema. Here's an example:

Input

{
     "name": "Bob Odenkirk",
     "title": "Software Engineer",
     "location": {
         "locality": "San Francisco",
         "region": "CA",
         "country": "United States"
     },
     "age": 62,
     "status": "Active"
}

Output

{
     "names": ["Bob Odenkirk"],
     "occupations": ["Software Engineer"],
     "locations": ["San Francisco, CA"]    
}

Essentially, I am looking for a language agnostic method (i.e., I don't care what programming language is used) of defining how an input JSON file should be parsed to an output JSON file.

4 Answers

The url https://github.com/bazaarvoice/jolt#jolt says that Jolt may be what you're looking for.

Jolt

JSON to JSON transformation library written in Java where the "specification" for the transform is itself a JSON document.

Useful For

Transforming JSON data from ElasticSearch, MongoDb, Cassandra, etc before sending it off to the world

Extracting data from a large JSON documents for your own consumption

Related