How to pass variable data to jsonstring?

How to pass variable data to jsonstring?

hi I want to add contacts via API through online form
How to pass the variable vallue?

array(
'authtoken' => key',
'JSONString' => '{"contact_name" => '$comp_name', "first_name" => '$first_name', "last_name" => '$last_name', "company_name" => '$comp_name', "payment_terms" => 15, 
"payment_terms_label" => "Net 15", "email" => '$email_from',
"notes" => "Online registered"}',
);

should I put it as
"contact_name" => '.$comp_name.', ??