JSON size calculation seems to work now.