I need to pass a JSON string in my Visualforce component : {'BillingCity':'Dubai'}

<apex:page showHeader="false" sidebar="false" standardController="Account" recordSetVar="accounts">
    <c:UploadObjectCSV objectName="Account" uniqueKey="Email__c" uniqueKeyName="Email__c" additionalInfo="{'BillingCity':'Dubai'}"/> 

this is how i am getting the variable 'additionalInfo':

<apex:attribute name="additionalInfo" type="String" required="true" description="Additional data to be added to the records." assignTo="{!additionalInfoValue}"/>

and this is how i am using it in my JS code:

var additionalData = '{!additionalInfoValue}';

I am getting the following error:

Uncaught SyntaxError: missing ) after argument list
  • try replacing the single quotes w escaped doublequotes in additionalInfo="{'BillingCity':'Dubai'}" – cropredy Nov 6 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.