Use JSON.stringify to properly escape control-characters when parsing metadata