Fix for crashing, and proper handling of json-c arrays