mergJSON and the ArrayToJSON script

Chris Heidecker hechris at
Sat Jun 12 01:21:27 EDT 2021


In the dictionary I found the ArrayToJSON -script to access mergJSON with a multi-dimensional array.
While trying to pass a number as a string I noticed the pForceRootType is not passed along to the enclosed ArrayToJSON function.

Adding the parameters does work for my array within an array.
		put "}"&ArrayToJSON(pArray[tKey],pForceRootType,pPretty) into pArray[tKey]

Is there a reason the parameters are not passed to the inner function?
Something unexpected I might encounter?

function ArrayToJSON pArray,pForceRootType,pPretty
	repeat for each key tKey in pArray
		if pArray[tKey] is an array then
         		put "}"&ArrayToJSON(pArray[tKey]) into pArray[tKey]
		end if
	end repeat
end ArrayToJSON

Chris Heidecker

More information about the use-livecode mailing list