Add a <a> tag with href and target="_black" for opening the link in new tab and use split to remove the href from json.

<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>   
    <table id="userdata" border="5">            
            <th>Revision  Date</th>
            <th>Document  Name</th>
            <th>Department </th>
            <th>Description</th>
            <th>Link</th>     
    </table>
<script>
        var data = {
        "person": [{
            "revisiondate": "21 April 2016",
            "documentname": "1658MC",
            "department": "Sales",
            "description": "Available",
            "link": "href=1658MC.pdf"
        }, {
            "revisiondate": "16 April 2016",
            "documentname": "VCX16B",
            "department": "Enginnering",
            "description": "Not Available",
            "link": "href=VCX16B.pdf"
        }, {
            "revisiondate": "15 March 2016",
            "documentname": "AB36F",
            "department": "Custumer Services",
            "description":  "Not Available",
            "link": "href=AB36F.pdf"
        }, {
            "revisiondate": "12 Agust 2016",
            "documentname": "FC25D",
            "department": "Technical Support",
            "description": "Not Available",
            "link": "href=FC25D.pdf"
        }]
    } 
    //$.getJSON("new4.json", function(data) {
    // console.log(data);

    //$.getJSON('new4.json', function(data) {
        $.each(data.person, function(i, person) {
            var tblRow =    "<tr><td>" + person.revisiondate + 
                            "</td><td>" + person.documentname + 
                            "</td><td>" + person.department +
                            "</td><td>" + person.description + 
                            "</td><td><a target='_blank' href='"+ person.link.split('href=')[1]+"' >"+person.link.split('href=')[1]+"</a></td></tr>"
            $(tblRow).appendTo("#userdata tbody");
        });
        //});
</script>
</body>
</html>
Run code snippetEdit code snippet Hide Results Copy to answer Expand

Answer from Bhuwan on Stack Overflow
Top answer
1 of 2
1

Add a <a> tag with href and target="_black" for opening the link in new tab and use split to remove the href from json.

<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>   
    <table id="userdata" border="5">            
            <th>Revision  Date</th>
            <th>Document  Name</th>
            <th>Department </th>
            <th>Description</th>
            <th>Link</th>     
    </table>
<script>
        var data = {
        "person": [{
            "revisiondate": "21 April 2016",
            "documentname": "1658MC",
            "department": "Sales",
            "description": "Available",
            "link": "href=1658MC.pdf"
        }, {
            "revisiondate": "16 April 2016",
            "documentname": "VCX16B",
            "department": "Enginnering",
            "description": "Not Available",
            "link": "href=VCX16B.pdf"
        }, {
            "revisiondate": "15 March 2016",
            "documentname": "AB36F",
            "department": "Custumer Services",
            "description":  "Not Available",
            "link": "href=AB36F.pdf"
        }, {
            "revisiondate": "12 Agust 2016",
            "documentname": "FC25D",
            "department": "Technical Support",
            "description": "Not Available",
            "link": "href=FC25D.pdf"
        }]
    } 
    //$.getJSON("new4.json", function(data) {
    // console.log(data);

    //$.getJSON('new4.json', function(data) {
        $.each(data.person, function(i, person) {
            var tblRow =    "<tr><td>" + person.revisiondate + 
                            "</td><td>" + person.documentname + 
                            "</td><td>" + person.department +
                            "</td><td>" + person.description + 
                            "</td><td><a target='_blank' href='"+ person.link.split('href=')[1]+"' >"+person.link.split('href=')[1]+"</a></td></tr>"
            $(tblRow).appendTo("#userdata tbody");
        });
        //});
</script>
</body>
</html>
Run code snippetEdit code snippet Hide Results Copy to answer Expand

2 of 2
0
$.each(data.person, function(i, person) {
            var tblRow =    "<tr><td>" + person.revisiondate + 
                            "</td><td>" + person.documentname + 
                            "</td><td>" + person.department +
                            "</td><td>" + person.description + 
                            "</td><a href='" + person.link + "'>link text</a><td>" +
                            "</td></tr>"
            $(tblRow).appendTo("#userdata tbody");
        });

You should remove the attrribute 'href' from your json

Or you could just add single quotes to your json data links like so

var data = {
        "person": [{
            "revisiondate": "21 April 2016",
            "documentname": "1658MC",
            "department": "Sales",
            "description": "Available",
            "link": "href='1658MC.pdf'"
        }, {
            "revisiondate": "16 April 2016",
            "documentname": "VCX16B",
            "department": "Enginnering",
            "description": "Not Available",
            "link": "href='VCX16B.pdf'"
        }, {
            "revisiondate": "15 March 2016",
            "documentname": "AB36F",
            "department": "Custumer Services",
            "description":  "Not Available",
            "link": "href='AB36F.pdf'"
        }, {
            "revisiondate": "12 Agust 2016",
            "documentname": "FC25D",
            "department": "Technical Support",
            "description": "Not Available",
            "link": "href='FC25D.pdf'"
        }]


$.each(data.person, function(i, person) {
            var tblRow =    "<tr><td>" + person.revisiondate + 
                            "</td><td>" + person.documentname + 
                            "</td><td>" + person.department +
                            "</td><td>" + person.description + 
                            "</td><a " + person.link + ">link text</a><td>" +
                            "</td></tr>"
            $(tblRow).appendTo("#userdata tbody");
        });
🌐
jsonurl
jsonurl.org
JSON inside a URL
It is common for applications to ... which do not modify a resource's state. JSON→URL defines a text format for the JSON data model suitable for use within a URL/URI....
Discussions

Formatting URL's in JSON string
I am trying to add URL to JSON schema which looks like "mainEntityOfPage": { "@type": "WebPage", "@id": "{{ .Site.BaseURL }}" } This renders out like this "mainEntityOfPage": { "@type": "WebPage", "@id": "http:\/\/domain.com\/" } How should I make http:\/\/domain.com\/ to http://domain.com/? ... More on discourse.gohugo.io
🌐 discourse.gohugo.io
11
0
April 22, 2019
how do i create a json file url?
i wasnt able to wrap my head around what u are trying to do. A blank json content can be created by JSON.stringify({}) More on reddit.com
🌐 r/webdev
3
2
June 7, 2020
How to make a JSON call to an URL? - javascript
You can't fetch data from remote URI in JavaScript unless explicit workarounds (such as JSONP) are put in place. Oh wait, reading the documentation you linked to - JSONP is available, but you must say 'js' not 'json' and specify a callback: format=js&callback=foo More on stackoverflow.com
🌐 stackoverflow.com
JSON url to link - javascript
I'm using the google news API and I want to add the value of the URL to be on the article title and convert the image from the JSON data to be viewable. More on stackoverflow.com
🌐 stackoverflow.com
July 1, 2018
People also ask

Is the URL to JSON converter really free?
Yes. Completely free, no signup required. Paste a URL and get JSON instantly. For high-volume conversion across many pages, use the Firecrawl API.
🌐
firecrawl.dev
firecrawl.dev › tools › url-to-json
Free URL to JSON Converter | Firecrawl
What does the JSON output include?
The converter extracts key page details like title, description, main content, headings, and important links into a clean JSON structure.
🌐
firecrawl.dev
firecrawl.dev › tools › url-to-json
Free URL to JSON Converter | Firecrawl
Can I customize the fields in the JSON?
This free tool uses a standard JSON structure. For custom schemas, prompts, or advanced extraction logic, use the Firecrawl API.
🌐
firecrawl.dev
firecrawl.dev › tools › url-to-json
Free URL to JSON Converter | Firecrawl
🌐
Firecrawl
firecrawl.dev › tools › url-to-json
Free URL to JSON Converter | Firecrawl
Paste a URL and get JSON instantly. For high-volume conversion across many pages, use the Firecrawl API. Any publicly accessible webpage: landing pages, docs, blog posts, product pages, and more. Firecrawl handles JavaScript-rendered sites that other converters struggle with. The converter extracts key page details like title, description, main content, headings, and important links into a clean JSON structure.
🌐
Restfuljson
restfuljson.org
RESTful JSON · Because adding links in JSON should be easy
JSON objects MAY append _url to properties to indicate related links
🌐
ReqBin
reqbin.com › req › 5nqtoxbx › get-json-example
How to get JSON from URL?
January 17, 2023 - To request JSON from an URL, you need to send an HTTP GET request to the server and provide the Accept: application/json request header with your request. The Accept header tells the server that our client is expecting JSON.
🌐
HUGO
discourse.gohugo.io › support
Formatting URL's in JSON string - support - HUGO
April 22, 2019 - I am trying to add URL to JSON schema which looks like "mainEntityOfPage": { "@type": "WebPage", "@id": "{{ .Site.BaseURL }}" } This renders out like this "mainEntityOfPage": { "@type": "WebPage", …
Find elsewhere
🌐
DEV Community
dev.to › hardiquedasore › how-to-add-link-to-json-49a3
How to a add link to JSON? - DEV Community
June 8, 2023 - In another edition to the JSON series, we can also add clickable links are part of the paragraph in the JSON. We can encapsulate the link in the anchor tag <a href='#'></a>. We can add the redirection link in the href so that the user can redirect ...
🌐
Medium
hardiquedasore.medium.com › how-to-add-a-link-to-json-162fc4b6c732
How to add a link to JSON?. In another edition to the JSON series… | by Hardique Dasore | Medium
June 8, 2023 - In another edition to the JSON series, we can also add clickable links are part of the paragraph in the JSON. We can encapsulate the link in the anchor tag <a href='#'></a>. We can add the redirection link in the href so that the user can redirect ...
🌐
CRAN
cran.r-project.org › web › packages › jsonlite › vignettes › json-apis.html
Fetching JSON data from REST APIs - CRAN - R Project
#search for best sellers books_key <- "&api-key=76363c9e70bc401bac1e6ad88b13bd1d" url <- "http://api.nytimes.com/svc/books/v2/lists/overview.json?published_date=2013-01-01" req <- fromJSON(paste0(url, books_key)) bestsellers <- req$results$list category1 <- bestsellers[[1, "books"]] subset(category1, select = c("author", "title", "publisher"))
🌐
Reddit
reddit.com › r/webdev › how do i create a json file url?
r/webdev on Reddit: how do i create a json file url?
June 7, 2020 -

var ajaxRequest = new XMLHttpRequest();

var email= document.getElementById('email').value;

var password= document.getElementById('password').value;

var name= document.getElementById('name').value;

var url = "input.json";

currently, i want the json file to take in user input from javascript, and i have the url as just input.json stored in a variable. how do i get an actual blank json file so that whenever the user inputs data with js, it stores it into the file?

🌐
Quora
quora.com › How-do-you-pass-a-JSON-object-in-a-URL
How to pass a JSON object in a URL - Quora
Answer (1 of 6): Usually you don’t; you’d pass the JSON object in the body of a POST request. This, for example, is how most websites work with their JSON and GraphQL queries. If you must, you’ll probably want to encode the JSON string in base64 and pass it as a query parameter in a GET ...
🌐
npm
npmjs.com › package › json-url
json-url - npm
August 24, 2025 - Generate URL-safe representations of some arbtirary JSON data in as small a space as possible that can be shared in a bookmark / link.
      » npm install json-url
    
Published: Aug 24, 2025
Version: 4.0.0
🌐
Stack Overflow
stackoverflow.com › questions › 51122530 › json-url-to-link
JSON url to link - javascript
July 1, 2018 - /*$.getJSON(url, function(data){ console.log(data); });*/ $.ajax({ url: "https://newsapi.org/v2/everything?apiKey=xxx&q=nrcs", dataType: "json", type: "get", cache: false, success: function (data) { $(data.articles).each(function (index, value) { //console.log(value); $('#news').append('<div>' + '<h3 id="title" style="color:#B8860B;">' + value.title + '' + value.url + '</h3>' + '<p>' + '<span style="color:#C4BFBF; font-style: italic;">' + value.author + '</span>' + '<br>' + value.publishedAt + '<br>' + value.description + '</p>' + '</div>'); $('#link').append(value.url); }); } });
🌐
Medium
manterapj.medium.com › how-to-pass-a-json-object-in-a-url-c46044e91c0d
How to pass a JSON object in a URL? | by Pankaj Yadav | Medium
January 7, 2023 - How to pass a JSON object in a URL? You must encode a JSON object as a string and include it in the query string portion of the URL to pass it in a URL. The object can be encoded as a string using …
🌐
ZetCode
zetcode.com › javascript › jsonurl
JavaScript JSON from URL - Fetching Data Explained
October 18, 2023 - The JQuery $.getJSON method loads JSON-encoded data from a server using a GET HTTP request. ... This is the method signature. The url parameter is a string containing the URL to which the request is sent. The data is a plain object or string that is sent to the server with the request.
🌐
GitHub
github.com › jsonurl › jsonurl-js
GitHub - jsonurl/jsonurl-js: JSON->URL defines a text format for the JSON data model suitable for use within a URL/URI (as described by RFC3986). This repository holds the JavaScript reference implementation of JSON->URL. · GitHub
JSON->URL defines a text format for the JSON data model suitable for use within a URL/URI (as described by RFC3986). This repository holds the JavaScript reference implementation of JSON-&am...
Author: jsonurl
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › URL › toJSON
URL: toJSON() method - Web APIs - MDN Web Docs
March 6, 2024 - const url = new URL( "https://developer.mozilla.org/en-US/docs/Web/API/URL/toString", ); url.toJSON(); // should return the URL as a string
Top answer
1 of 2
2
  • You could create a function which creates the URL based on the object provided.

    Destructure the parameter to get scheme, server, path. Assign a default value to path since it is optional. Get the remaining unknown properties to a rest variable using spread syntax (Properties like item, itemDetails etc will be inside the rest object)

  • You can create the base URL using the first 3 variables using a template literal

  • To get the query string, you can use URLSearchParams constructor. It has several overloads. You can pass a query string or an object or an array of entries as parameter to the constructor. If the object is flat, you simply do, new URLSearchParams(rest).toString() to create the query string. But, since you have nested arrays and objects, we need to create an array of entries first (Something like: [[key1, value1], [key2, value2],...and so on]. Then the string will be key key1=value1&key2=value2. The values will also be properly encoded to replace space and special characters etc)

  • You can create a recursive function to get the nested entries. Loop through the entries of the given object. If the current value is an Array, recursively call the method for each object in the array and push it to entries. If the value is an object, recursively call the function on the value. This function will return a 2-dimensional array of all the key-value pairs in the object.

  • Then simply pass the entries to URLSearchParams to create the query string. If the query string is not empty, append it to the base URL with a prefix of ?.

function createURL({ scheme, server, path = '', ...rest }) {
  let url = `${scheme}://${server}/${path}`;
  let param = new URLSearchParams(getEntries(rest)).toString();
  if (param)
    url += "?" + param;
  return url
}

function getEntries(o = {}) {
  const entries = [];
  for (const [k, v] of Object.entries(o)) {
    if (Array.isArray(v))
      entries.push(...v.flatMap(getEntries))
    else if (typeof v === 'object')
      entries.push(...getEntries(v))
    else entries.push([k, v])
  }
  return entries;
}

console.log(createURL({
  scheme: "https",
  server: "example.com"
}))

console.log(createURL({
  scheme: "https",
  server: "example.com",
  path: "items",
  item: "apple",
  "itemDetails": [{
    "country": "US",
    "year": "2019"
  }]
}))
Run code snippetEdit code snippet Hide Results Copy to answer Expand

2 of 2
-2

Maybe is not the best way, but you can try

var myjson = {
       scheme:https,
       server:example.com
};

    var obj = JSON.parse(myjson);
    document.getElementById("#div1").innerHTML = obj.scheme + obj.server;