• SriKavi
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi,
What is the best practice to generate JSON string for HTTP callouts? The options I know are:
1) Using String variables and methods
2) Use JSON.serialize function after defining a class
3) Use JSONGenerator
Using the above 3 methods, if we need to change the request, we have to change the code. Is there any other good solution so that the code need not be chaged even if the JSON request needs to be changed?
What is the best practice in generating JSON request?
Thanks.
Hi,
What is the best practice to generate JSON string for HTTP callouts? The options I know are:
1) Using String variables and methods
2) Use JSON.serialize function after defining a class
3) Use JSONGenerator
Using the above 3 methods, if we need to change the request, we have to change the code. Is there any other good solution so that the code need not be chaged even if the JSON request needs to be changed?
What is the best practice in generating JSON request?
Thanks.
Hi,

I'm currently struggling with Lightning Component Framework Specialist Challenge 10.

I'm successfully using an event to pass values into the Map's client side controller, and Leaflet seems to be doing something, but:

1. The marker is displayed on a grey area, not a map.
2. When I click a second boat, instead of updating the map, an error pops up informing me "Uncaught Action failed: c:Map$controller$onPlotMapMarker [Map container is already initialized.]"

This is my onPlotMapMaker method:
 
onPlotMapMarker: function(component, event, helper) {
    	var id = event.getParam('sObjectId');
    	var lat = event.getParam('lat');
    	var long = event.getParam('long');
    	var label = event.getParam('label');

    	var mapContainer = component.find('map').getElement(); 
	    var map = L.map(mapContainer).setView([lat, long], 13);

		L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
		    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
		}).addTo(map);
		
		L.marker([lat, long]).addTo(map)
		    .bindPopup(label)
		    .openPopup();
    }

What's wrong with it?