Fix: json parsing completes though a short work buffer is used

Fix: json parsing completes though a short work buffer is used.
Test case also included.