Chrome扩展程序json文件

I'm using Chrome Extension to change a sites CSS/javascript.

I'm looking to manipulate the layout and get data.

Inspecting the code on the website I can see it has a json file, similar to the below:

< form id='preference' data-json={'name':'test','age':'40'},{'name':'test','age':'30'},{'name':'test','age':'50'} >

How would I loop through the information in the JSON file?

Suppose you have a JSON like this or you convert your data like the format below:

var data =   [{
        "name": "test",
        "age": "40"
    }, {
        "name": "test",
        "age": "30"
    }, {
        "name": "test",
        "age": "20"
    }]

As you are asking, how to loop through JSON. Follow this:

data.forEach(function(d){
                console.log("Name: " + d.name);
                console.log("Age: " + d.age);
            });