Changed resolved_path to NULL so realpath() uses malloc to allocate a buffer.
added necessary escape for json