Update Json.fs

Support multiple types when using to_json. For example if an array was used instead of an object, this function would fail.