-1

I'm using Brackets to edit a json file with about 1000 lines of code. I want to extract (copy) just the text in orange... How can I do that? :)

here's a screenshot of the .json file

masilli
  • 1
  • 2

2 Answers2

0

The orange text is just your text editor. Not idea what editor you're using but on Sublime I'd do a find all on ":" then select all. Shift + Home key will select end of row (or its shift insert, I'm on a beach atm and can't exactly remember) With that it will select everything after the ":" which you can copy and cut down from there.

Guest
  • 1
0

It looks like you want to extract the strings from a nested dictionary. Leveraging Recursively looping through an object to build a property list you could do:


var myobject = {
    aProperty: {
        aSetting1: ["asdf","bab"]      
    },
    bProperty: {
        bSetting1: {
            bPropertySubSetting : true
        },
        bSetting2: "bString"
    },
    cProperty: {
        cSetting: "cString"
    }
}

function iterate(obj) {
        for (var property in obj) {
            if (obj.hasOwnProperty(property)) {
                if (typeof obj[property] == "object") {
                    iterate(obj[property]);
                } else if (typeof obj[property] == "string") {
                    console.log(obj[property]);                    
                }
            }
        }
    }

iterate(myobject)

Henryk Gerlach
  • 146
  • 1
  • 4