No way to distinguish between "end of object" and field with blank name
aucampia opened this issue · 1 comments
aucampia commented
func (iter *Iterator) ReadObject() (ret string)
ReadObject read one field from object. If object ended, returns empty string. Otherwise, returns the field name.
Lines 40 to 41 in 71ac162
The problem with this is, there is, as far as I can tell, no way for the caller to distinguish between empty field names and end of object.
I guess it is not incredibly easy to fix this without breaking the API. One option is to provide some function for checking if the next input is end of array, or end of object, that way users can call that before calling ReadObject(...).
aucampia commented
Maybe adding another function func (iter *Iterator) ReadObject() (hasMore bool, ret string) can work?