Skip to content

Instantly share code, notes, and snippets.

@EDCHRONO-GIT
EDCHRONO-GIT / Json duplicate eliminator.html
Last active August 29, 2015 14:04
Eliminating Duplicates in JSON using JavaScript
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<title>
JavaScript to find duplicates in JSON file
</title>
@EDCHRONO-GIT
EDCHRONO-GIT / InputfieldDemoController
Last active March 16, 2016 02:02
VisualForce: Passing Values from Javascript to Controller
public class InputfieldDemoController {
//Variable under test
public String valuefromJS {get; set;}
public pagereference someMethod(){
System.debug(valuefromJS);
return null;
@EDCHRONO-GIT
EDCHRONO-GIT / JSONParserDemo.java
Last active August 29, 2015 14:05
Parsing JSON in Salesforce
public class JSONParserDemo {
//Considering the same JSON from previous post but only with two questions
String jsonstring ='{"Questions": {"Question": [{"Q": "Which of the following is a responsibility of Supplier Management?","o1": "Development, negotiation and agreement of Operational Level Agreements (OLAs)","o2": "Development, negotiation and agreement of the Service Portfolio", "o3": "","a": "Development, negotiation and agreement of contracts","ua": "NA"},{ "Q": "Which of the following does the Availability Management process include? 1. Ensuring services are able to meet availability targets 2. Monitoring and reporting actual availability 3. Improvement activities, to ensure that services continue to meet or exceed their availability goals", "o1": "1 and 2 only","o2": "1 and 3 only","o3": "","a": "All the Above","ua": "NA"}]}}';
List<QuestionsWrapper> parsedquestions = new List<QuestionsWrapper>();
public List<QuestionsWrapper> getParsedquestions(){
// Create
public class RestCalloutDemo {
public string weatherJSON;
public string city{get;set;}
public WeatherWrapper ww{get;set;}
public pageReference requiredWeatherJSON()
{
//Step 1: Create a http request object
Http httpProtocol = new Http();