Importjsonline and more


I have not been able to get importjsonline to work, it is crashing.

I am writing a json file and then loading it at another time with this code.
vResults = binarytotext(fileload(vResponsePath + |Steve Middleton-3636378181.txt|))
importjsonline vResults

I have tried so many variations that I am now lost in my head. Any clearer, wiser thoughts are welcome.


What’s the text in your file? What are your database fields?


The text is all xml text with one timestamp field. Partial below.

"Contacts" : "<Prefix><\/Prefix>;<First>Jim<\/First>;<Middle><\/Middle>;<Last>Smith<\/Last>;<\/Suffix><\/Suffix>;<Title><\/Title>;<eMail><\/eMail>;<ConfirmEmail><\/ConfirmEmail>;

What I am trying to do is simply save a record from one database and load it into another database on a different computer. I have tried exportline() and jsonexportline(). I am trying to avoid hand coding every database to do this. I have read but never tried using batchassign or some other way to build a formula to execute that would work in any database.


Are you saying that Panorama generated that text? Because it isn’t JSON – XML and JSON are different things. It sort of could be a weird JSON, with just one item, “Contacts”, but if so, it is missing a quote on the end (maybe you just left that out when pasting into the forum?). But it looks like you have XML data with a bunch of different fields – Prefix, First, Middle, etc. IMPORTJSONLINE isn’t going to do anything with those fields, they aren’t in JSON format.


Correct, there are fields with xml in them, so the Contacts field has xml for First, Middle, Last…etc, I used xml because of xtag() and xtagvalue(). The json was just one way to “post” a record to a different computer. I know it is rather odd to use them together.


If you have only one field, and a fixed field at that, using JSON is rather pointless and adds a layer of unnecessary complexity without any benefit. Just transfer the text.

You didn’t respond about the missing quote on the end. That makes the JSON malformed, that may be the cause of the crash problem if it is in fact missing. However, that is only of academic interest I think, though I am curious since I’m wondering if I can duplicate the crash. Even though your application isn’t appropriate for JSON, definitely want to make sure it works for everyone else (and I should note that I have heard from users that have successfully used JSON).


Understood, I was using json for the simplicity of export and import. I sent you a link to the complete file.


I just tried loading the file using

local vFile
loadurl vFile, ||
importjsonline vFile

And it worked fine. So I must be doing some text encoding I am not aware of?


I thought that was a real URL I could look at, but apparently it’s a dummy? I tried to look at it and got a message that the domain was for sale.

FYI, I haven’t received any email from you today.

I’m puzzled as to how this is simpler. If I understand what you are doing, you could just export the data from your database like this:

filesave "somefile.txt",Contacts

And import it into a different database like this:

Contacts = binarytotext(fileload("somefile.txt"))

Or maybe you are putting this on a web server, then

Contacts = binarytotext(url(""))

HOLD THE PHONE!!, your original code was:

binarytotext(fileload(vResponsePath + |Steve Middleton-3636378181.txt|))

What was in vResponsePath? Since you were using fileload(, I was assuming it was a path to a file on your local drive. But with your new example, I’m wondering – was it a URL to a web server? If so, the crash was probably from passing a URL to fileload(, that function is only for local files on your hard drive, and had nothing to do with JSON.

This example illustrates why it is so critical to post complete details when submitting a support question. When a key detail is held back, neither I or anyone else is going to be able to assist. And if you don’t understand what is going on, you probably don’t know what a key detail is, so it’s best to not hold anything back. Make sure there is no missing context. It will take longer to submit your post, perhaps much longer, but in the long run you’ll get your answer quicker with a lot less frustration for everyone. I rarely ask questions on Stack Overflow (a forum for professional programmers), but when I do, I’ll usually take hours to make sure that I’ve covered every detail needed for someone to assist. (And often in thinking so carefully about how to ask the question, I come up with the answer myself.)