Added bad JSON detection