0

I got sent a link to what is allegedly a "program API" for sort of a marketplace website. It lists some of the ads on the website and I'm supposed to use it as input for a Java app running on the local machine. Example:

    [ {
      "id" : 32376,
      "name" : "Example offer",
      "story" : "Blah blah blah",
      "purpose" : "9",
      "photos" : [ {
        "name" : "neatPicOfTheStuff.jpg",
        "url" : "/loans/32376/photos/2032"
      } ],
      "nickName" : "Pajunda",
      "termInMonths" : 84,
      "interestRate" : 0.049900,
      "rating" : "AAAA",
      "topped" : null,
      "amount" : 215000.00,
      "remainingInvestment" : 123800.00,
      "investmentRate" : 0.4241860465116279,
      "covered" : false,
      "datePublished" : "2016-05-23T09:34:52.323+02:00",
      "published" : true,
      "deadline" : "2016-05-30T08:57:58.050+02:00",
      "investmentsCount" : 149,
      "questionsCount" : 4,
      "region" : "2",
      "mainIncomeType" : "EMPLOYMENT"
    }, {
//another ad
} ]

This data format looks understandable enough, and I probably could cobble together some String processing methods to get what I need out of it, but this looks to me like a standard format of some sort, so I figured out I'd rather ask first rather than spend a day or two reinventing the wheel and making the resulting app hard to maintain to boot. Searching for "program API" returns irrelevant results, and there is no indication of the name of this format. And so I need to know:

  1. If this data is indeed formatted according to some standard, what is its name?

  2. Is there a library out there to work with it, for iterating through the elements of the list of the ads, extracting values of the variables, and so on?

Sargon1
  • 854
  • 5
  • 17
  • 48

2 Answers2

2

The data format is called JSON and you can read more about it here: http://www.json.org/

On how to parse JSON in Java you can see this previous answer on StackOwerflow: How to parse JSON in Java

Community
  • 1
  • 1
1

The data you've posted is in JSON Format. There are plenty of libraries like Jackson which you could use to parse JSON content directly into POJOs, etc.

Chetan Jadhav CD
  • 1,116
  • 8
  • 14