parses json into struct