This post explains how to access a XML/JSON file present in media library from Sitecore controller rendering. This will use a Controller rendering to render a page and the XML/JSON file is accessed inside the controller action method.
There is no direct way in javascript/jquery to check if a string is in JSON compatible format, but we can achieve by a small work around.