How to process null value inside json string array from mysql using json.decode?

I need help. I have this error

 ERROR: Runtime error

23:26:26.937  C:\Users\DIEGO\Documents\Corona Projects\jeovanys salon\database.lua:57: attempt to concatenate field ‘?’ (a nil value)

23:26:26.937  stack traceback:

23:26:26.937   [C]: ?

23:26:26.937   C:\Users\DIEGO\Documents\Corona Projects\jeovanys salon\database.lua:57: in function <C:\Users\DIEGO\Documents\Corona Projects\jeovanys salon\database.lua:43>

I need to insert null values ​​to sqlite

function db.descargar_sucursal()

local URL =Ini.IP…"/getSucursal.php?idcompany="… mime.b64(Ini.idcompany)

local function networkListener( event )

  if ( event.isError ) then

   ok_alert = native.showAlert( “Error!!”, “Network error!” ,{ “OK”} )

  else

   decodedData = json.decode( event.response )

   if decodedData == nil then

   else

    db.LimpiarTablaSqlite(“delete from sucursal”)

    for key in pairs(decodedData) do

     local tablefill =“INSERT INTO sucursal(idsusursal,idcompany,idstatus,nombre,direccion,telefono,telefono2,email,fax,localizacion,”

     …“horario,facebook,twitter,instagram,web) VALUES (’” … decodedData[key][1] …"’,’" … decodedData[key][2] …"’,’" … decodedData[key][3] …"’,"

     …"’" … decodedData[key][4] …"’,’" … decodedData[key][5] …"’,’" … decodedData[key][6] …"’,’" … decodedData[key][7] …"’,"

     …"’" … decodedData[key][2] …"’,’" … decodedData[key][2] …"’,’" … decodedData[key][2] …"’,’" … decodedData[key][2] …"’,"

     …"’" … decodedData[key][2] …"’,’" … decodedData[key][2] …"’,’" … decodedData[key][2] …"’,’" … decodedData[key][2] …"’);"

     db.InsertarTablaSqlite(tablefill)

    end

   end

  end

end

    network.request(URL, “POST”,networkListener)

end

this is my PHP json server

<?php 

require_once(‘conexion.php’);

$data = file_get_contents(‘php://input’);

$idcompany = base64_decode($_GET[“idcompany”]);

$sql=‘select * from sucursal where idcompany="’.$idcompany.’"’;

mysqli_set_charset($con, “utf8”);

$result = mysqli_query($con,$sql);

$json = array(); 

if(mysqli_num_rows($result))

{

while($row=mysqli_fetch_row($result))

$json[]=$row; 

echo json_encode($json,JSON_UNESCAPED_UNICODE); 

mysqli_close($con); 

?>

print(event.response)

23:26:26.926  [[“4”,“1”,“1”,“Barbería Jeovany Creations”,“Avenida 3a Oeste, David, Panamá”,“65992922”,"","","",“Nulo”,“4:00 Pm- 9:00 Pm”,"@jeostylechiriqui",“NULL”,“Jeovany_style_chiriqui”,null,“1”]]

When using json.decode, you can specify an alternate value rather than nil to be returned if the json value is null.

https://docs.coronalabs.com/api/library/json/decode.html

When using json.decode, you can specify an alternate value rather than nil to be returned if the json value is null.

https://docs.coronalabs.com/api/library/json/decode.html