Added JSON output. The JSON is not valid yet, needs fixes.
Many fixes for the JSON output -> It now produces valid JSON efficiently.