rest - looping over json response in classic asp -


so making rest request jira api , getting json response includes objects.

my request this:

set restreq = createobject("msxml2.serverxmlhttp.3.0") restreq.open "get", "uri",false restreq.setrequestheader  "authorization","basic{user:password}" restreq.setoption sxh_option_ignore_server_ssl_cert_error_flags,sxh_server_cert_ignore_all_server_errors restreq.send("") 'response.write(restreq.responsetext)    

the response.write looks (but longer):

[{"self":"https://jira:8343/rest/api/2/project/ct","id":"10004","key":"ct","name":"core technologies"}}, {"self":"https://jira:8343/rest/api/2/project/ctccg","id":"10006","key":"ctccg","name":"ct ccg"}}] 

i able loop through response , use "id", "key" , "name" in unordered list. can create ul, how extract information need json?

you check this question relating using gson library. small, quick , easy use convert between json objects.

import java.io.filereader;  import com.google.gson.gson;  public class test {  public static void main(string[] args) throws exception {     gson gson = new gson();     typedto[] mytypes = gson.fromjson(new filereader("d:\\temp\\inputjson.txt"), typedto[].class);     (int = 0; < mytypes.length; ++i)         system.out.println(mytypes[i].self);  }  class typedto {   string self;   string id;   string key;   string name; } } 

inputjson.txt had

[{"self":"https://jira:8343/rest/api/2/project/ct","id":"10004","key":"ct","name":"core technologies"},  {"self":"https://jira:8343/rest/api/2/project/ctccg","id":"10006","key":"ctccg","name":"ct ccg"}] 

note absence of addtional } when compared yours @ end of each line.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -