javascript - How to get specific property from Google Spreadsheet JSON feed -


i reading json google spreadsheet , need getting text within entry.content.$t. text column named "description" in spreadsheet. feed spreadsheet (removed)

so far, script is

function listchapters(root) {     var feed = root.feed;     var entries = feed.entry || [];     var html = ['<ul>'];     (var = 0; < entries.length; ++i) {         var chlist = entries[i];         var title = (chlist.title.type == 'html') ? chlist.title.$t : escape(chlist.title.$t);         var chapters = chlist.content.$t;         html.push('<li>', chapters, '</li>');     }     html.push('</ul>');     document.getelementbyid("chapterlist").innerhtml = html.join(""); } 

the question - how read "description" $t place in var chapters?

the text within chlist.content.$t almost, not quite, formatted json. since it's not formatted, cannot use json.parse() create object description property from.

here's brute-force approach extract description, used in place of original html.push('<li>', chapters, '</li>');:

// text between 'description: ' , 'chapter website:' var descstart = chapters.indexof('description:')+13;  //+length of 'description: ' var descend = chapters.indexof('chapter website:'); var description = chapters.substring(descstart,descend);  html.push('<li>', description, '</li>'); 

tested this, checking results in debugger:

function test() {   var url = '---url---';   var result = urlfetchapp.fetch(url);   var text = result.getcontenttext();   var bodytext = xml.parse(text,true).html.body.gettext();   var root = json.parse(bodytext);   listchapters(root); } 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -