Fixed bug in json serialization (keys were integer indices instead of field names)