More casts etc. to allow compiling as C++
Make use of the json_object_entry struct now not being anonymous to make some lines more concise