Completed JSON reading, including tests equal to the Java implementation.