Fixes for JSON Reader and Writer

JSONReader: read end of objects in iterations
JSONWriter: only write iteration if it contains data