S salmander Active Member Licensed User Longtime User Jun 11, 2012 #1 Hello, I have a TEXT field in the database. I am storing a MAP in this text field. It is storing the MAP fine. However, I can't convert this text into a MAP object, when I load the field from the database again. Code: Copy dim data as string dim map1 as Map data = sql1.ExecQuerySingleResult2("SELECT all_operations FROM tblJobs WHERE device_job_id=?", Array As String(device_job_id)) map1 = data I have also tried converting the text to JSON and then assigning it to map, which also didn't work. Code: Copy dim data as string dim map1 as Map dim json as JSONParser data = sql1.ExecQuerySingleResult2("SELECT all_operations FROM tblJobs WHERE device_job_id=?", Array As String(device_job_id)) json.Initialize(data) map1 = json.NextObject Can anyone please help me?
Hello, I have a TEXT field in the database. I am storing a MAP in this text field. It is storing the MAP fine. However, I can't convert this text into a MAP object, when I load the field from the database again. Code: Copy dim data as string dim map1 as Map data = sql1.ExecQuerySingleResult2("SELECT all_operations FROM tblJobs WHERE device_job_id=?", Array As String(device_job_id)) map1 = data I have also tried converting the text to JSON and then assigning it to map, which also didn't work. Code: Copy dim data as string dim map1 as Map dim json as JSONParser data = sql1.ExecQuerySingleResult2("SELECT all_operations FROM tblJobs WHERE device_job_id=?", Array As String(device_job_id)) json.Initialize(data) map1 = json.NextObject Can anyone please help me?
Erel B4X founder Staff member Licensed User Longtime User Jun 11, 2012 #2 There is no automatic way to parse and rebuild a map from its string representation. If your Map only includes string values then you can use JSONGenerator to create a valid JSON text and store it in a database. Upvote 0
There is no automatic way to parse and rebuild a map from its string representation. If your Map only includes string values then you can use JSONGenerator to create a valid JSON text and store it in a database.