refactored jsonparser to accept data instead of object, error as out parameter