Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8293665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:54:19+00:00 2026-06-08T13:54:19+00:00

I got this working with XML (Thanks to the help of those on here),

  • 0

I got this working with XML (Thanks to the help of those on here), but now I need to do the same with a JSON response. I need to parse the response and populate a google spreadsheet. Any help with the code or pointers to where I can find examples for this are greatly appreciated!

Here’s the url “http://www.sciencebase.gov/catalog/items?s=Search&q=water&format=json&max=3”

and here’s what it returns

{

"rel": "self",
"url": "https://www.sciencebase.gov/catalog/items?max=3&s=Search&q=water&
format=json",
"total": 475972,
"nextlink": {
    "rel": "next",
    "url": "https://www.sciencebase.gov/catalog/items?max=3&s=Search&q=water
     &format=json&offset=3"
},
"items": [
    {
        "link": {
            "rel": "self",
            "url": "https://www.sciencebase.gov/catalog/item/
         4f4e4a0ae4b07f02db5fb83c"},
        "id": "4f4e4a0ae4b07f02db5fb83c",
        "oldId": 1796213,
        "title": "Water Resources Data, Iowa, Water Year 2003--Volume 2. 
         Ground Water and Quality of Precipitation", 
        "summary": "Water 
         resources data for Iowa for the 2003 water year consists of 
         records of ground water levels and water quality of ground-water 
         wells. This report volume contains water-level records for 166 ground-
         water observation wells; water-quality data for 150 municipal wells; 
         and precipitation-quality data for 2 precipitation sites.",
        "hasChildren": false
    },
    {
        "link": {
            "rel": "self",
            "url": "https://www.sciencebase.gov/catalog/item/
        4f4e4a62e4b07f02db6369dc"
        },
        "id": "4f4e4a62e4b07f02db6369dc",
        "oldId": 1800335,
        "title": "Reconnaissance of the water resources of Beaver County, 
         Oklahoma",
        "summary": "Ground water is the major source of water supply in 
         Beaver County. Because of the rapidly increasing demand for the 
         limited supply of water for irrigation, additional geologic and 
         hydrologic data are needed for management of ground-water resources. 
         This report presents general information on the availability of 
         ground water, on the chemical quality of water, and on streamflow. 
         The chemical quality of water generally is poorer than that of 
         water elsewhere in the Oklahoma Panhandle, and the ability to obtain 
         good quality water may become increasingly difficult as the water 
         resources are developed.\r\nFurther studies are needed to determine 
         the annual change in water levels, the rate of water-level decline in 
         heavily pumped areas, the volume of water stored in the ground-
         water reservoir, and the quantity of water that may be withdrawn 
         safely in a given area.",
        "hasChildren": false
    },
    {
        "link": {
            "rel": "self",
            "url": "https://www.sciencebase.gov/catalog/item/
        4f4e4a0de4b07f02db5fd2c3"
        },
        "id": "4f4e4a0de4b07f02db5fd2c3",
        "oldId": 1794688,
        "title": "Water Resources Data - Texas, Water Year 2003, Volume 6. 
         Ground Water",
        "summary": "Water-resources data for the 2003 water year for Texas 
         consists of records of stage, discharge, and water quality of 
         streams; stage and contents in lakes and reservoirs; and water 
         levels and water quality in wells. Volume 6 contains water levels for 
         880 ground-water observation wells and water-quality data for 158 
         monitoring wells. These data represent that part of the National 
         Water Data System operated by the U.S. Geological Survey and 
         cooperating Federal, State, and local agencies in Texas.",
        "hasChildren": false
    }
]

}

This is the code I have and this was based off of getting a return of XML

function respondToSearch()
{

   var ss = SpreadsheetApp.getActiveSpreadsheet(); 
   var sheet1 = ss.getSheets()[0].setColumnWidth(2, 500);
   var cellSearch = sheet1

   // Get the response back from the url as a string
   var response = UrlFetchApp.fetch("http://www.sciencebase.gov/catalog/items?
   s=Search&q=water&format=json&max=3");

   // Parse the xml string, returns and xml document
   var parsedResponse = Utilities.jsonParse(response.getContentText());

   // for loop to display imported data down (a1:a10) the spreadsheet. Sets 
   a wider column width for 
   for (var i = 0; i < parsedResponse.items.item; i++) {
       var result = parsedResponse.items[i];
       var print = result.getElement("title").getText();
       var cellLtrs = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", 
       "l", "m", "n"];
       var cellLetter = cellLtrs[0];
       var cellNum = [i + 1];
       var both = cellLetter + cellNum;

  sheet1.setColumnWidth(1, 
  100).setActiveCell(both).setFontSize("9").setHorizontalAlignment("left").
  setVerticalAlignment("top").setValue(print);
 }

}

Thanks again

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T13:54:22+00:00Added an answer on June 8, 2026 at 1:54 pm

    Use

    var print = parsedResponse.items[i].title;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got this line of code here but its not working. private void Button_Click(object sender,
I got very basic question. Why this is not working?! <?xml version=1.0 encoding=utf-8?> <s:Application
Update: Got this working by disabling CodeIgniter Profiler which was interfering with the Ajax
Has anyone got this working in a web application? No matter what I do
i got this code working and it to return the last tweet from my
Has anyone got this configuration working? Latest Netbeans, latest Glassfish, I created an EJB
I got this problem with AVAudioRecorder not working for me, at least from what
I've got this strange situation going on. Imagejpeg is only working when I define
I've got this ASP.NET 2.0 website project in Visual Studio that I've been working
I have been working on this for few hours and got stuck, so how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.