[library] Tweak JSON sample code