SugarSmarty JSON data handling from DB field

I have a custom field type and in the edit view, i am saving the value in the field as

The data is saved correctly in the database for the field value. Below is a sample of the data save for one record.

[{"file_name":"banner.png","file_db_id":"86f98f62-fa4a-31b6-5f53-5a4dba828e8d","file_tag":"Nails"},{"file_name":"Safari.png","file_db_id":"9eb100df-dde7-e141-146f-5a4dba35b83c","file_tag":"Spa"}]

Now in order to manipulate the saved data in the DetailView.tpl of the field, have following code.


{assign var="valueJSON" value={{sugarvar key="value" string=true}}}

{foreach from=$valueJSON item=fileValues key=FileIndex}
  {assign var=fileItem value=$fileValues|json_decode:1}
       {$fileItem->file_name} 
{/foreach}

The above code does not print anything in the detail view for the field. However if i provide {$valueJSON} value in the TPL, it gives the exact JSON stream ( [{“file_name”:"banner.png…) .

How can i loop through the values or change this $valueJSON to proper json object to access values.