Data Map a JSON file?

Just curious, before I start tackling this myself, has anyone written a Data Map against a JSON file? Specifically, I want to data map the contentset:

var url = “http://localhost:9340/rest/serverengine/entity/contentsets/” + contentsetid + “/pages?detail=true”;

If you stringify the result, you get the attached results.

Each “ID” should be a record, and the pages array should be a detail record.

I want to write a standard reporting module for our jobs that reports on document count, page count, count and name of each media type, and summary totals for the job. The ContentSet has all of this information, so my approach would be to run a script to generate the JSON file, Data Map, and then likely do an email.

[{“id”:493514,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:2,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493515,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493516,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493517,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:2,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493518,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493519,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493520,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493521,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493522,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:6,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493523,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493524,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493525,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:4,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]},{“id”:493526,“pages”:[{“count”:2,“media”:{“name”:“Letter”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}},{“count”:2,“media”:{“name”:“YELLOW”,“size”:“Letter”,“width”:“8.5in”,“height”:“11in”}}]}]

You can’t natively data map a JSON file (yet!) but with version 1.8, there is a Workflow Action task that allows you to convert from JSON to XML or from XML to JSON. You could use that and then data map the XML.