~nextIterationFields = Case (
~isJSON; ConvertToNonNestedJSON ( ~thisPath ; ~thisValue ) ;
not IsEmpty ( ~nextIterationFields ) ;
~error1 = Left (JSONFormatElements ( ~fields ) ; 1 ) ≠ "[" and not IsEmpty ( ~fields ) ;
~error2 = Left (JSONFormatElements ( ~nextIterationFields ) ; 1 ) ≠ "[" and not IsEmpty ( ~nextIterationFields );
~combinedArrays = Left ( ~fields ; Length ( ~fields ) - 1 ) & "," & Right ( ~nextIterationFields ; Length ( ~nextIterationFields ) - 1 )
~error1 or ~error2 ; "error" ;
IsEmpty ( ~fields ) ; ~nextIterationFields ;
IsEmpty ( ~nextIterationFields ) ; ~fields ;
#index = Case ( IsEmpty ( ~fields ) ; 0 ; ValueCount ( JSONListKeys ( ~fields ; "" ) ) ) ;
#error = Case ( Left ( #index ; 1 ) = "?" ; "Invalid Array" ) ;
#thisField = JSONSetElement ( ~baseJSON ;
[ "field" ; ~thisKey ; JSONString ] ;
[ "type" ; ~thisValue ; JSONString ]
~thisKey = "@type" or ~thisKey = "@context" ; ~fields ;
JSONSetElement ( #theArray ; #index ; #thisField ; JSONObject )