initial approach (Json.java is the final and better approach)