how to create a records array for upsertRecord

how to create a records array for upsertRecord

Hi I need to create an $recordsArray to usert my record, currently i am using json_encode to convert my php array to json, 
try {
$recordsArray = [ "data" => [
"First_Name" => "fname",
"Name" => "lname",
"Email" => "badboy@gmail.com"],
];

var_dump( json_encode( $recordsArray, JSON_PRETTY_PRINT));
$zcrmModuleIns = ZCRMModule:: getInstance( "contacts");
$bulkAPIResponse = $zcrmModuleIns-> upsertRecords( json_encode( $recordsArray)); // $recordsArray - array of ZCRMRecord instances filled with required data for upsert.
$entityResponses = $bulkAPIResponse-> getEntityResponses();
foreach ( $entityResponses as $entityResponse) {
if ( "success" == $entityResponse-> getStatus()) {
echo "Status:" . $entityResponse-> getStatus();
echo "Message:" . $entityResponse-> getMessage();
echo "Code:" . $entityResponse-> getCode();
$upsertData = $entityResponse-> getUpsertDetails();
echo "UPSERT_ACTION:" . $upsertData[“action”];
echo "UPSERT_DUPLICATE_FIELD:" . $upsertData[“duplicate_field”];
$createdRecordInstance = $entityResponse-> getData();
echo "EntityID:" . $createdRecordInstance-> getEntityId();
echo "moduleAPIName:" . $createdRecordInstance-> getModuleAPIName();
}
}
} catch ( ZCRMException $e) {
//var_dump($e);
echo $e-> getCode();
echo $e-> getMessage();
echo $e-> getExceptionCode();
}
I am getting 400 Invalid Data everytime I anybody please provide with an example to do the upsert record. I have already gone through the documentation and tried everything.