Parsing Instagram JSON on Apex

Last week I had a challenge of making a API callout to Instagram from Salesforce and then parse the returned JSON content and the mapped the values to become a record for a custom object. Basically each media post and comments becomes a record in Salesforce.

First off you can start by reading this article

According to http://www.json.org:

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. … JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.

To begin, what I have here is an API request for comments for a particular media or picture I have in Instagram.

Read the rest of this entry »