JSON functionality

Fixed major bug in JSON functionality (reverted), changed order of JSON
output and added content section to output.