Hi Eric

Thank you for your response which was a great help. The only problem now is
that when I try a test JSON structured as suggested I get the following
error message
JSON error: SyntaxError: JSON.parse: unexpected character at line 8
column 1 of the JSON data
That character is the closing square bracket.
This is the content of the JSON file

[
{
"created": "2.02E+16","text": "55.2521","Tags": "","Title": "Ailsa Craig
Lighthouse","modified": "2.02E+16"
},
{
"created": "2.02E+16","text": "56.72716667","Tags": "","Title":
"Ardnamurchan Lighthouse","modified": "2.02E+16"
},
]

What i actually want to do is to insert the data columns in my csv file
into fields in each tiddler. I set up a tiddler in the format that I want
and exported it to see the structure and then created the following file
JSON2 with the additional fields after the 'modified' field.

[
{"created": "2.02E+16","text": "","Tags": "","Title": "Ailsa Craig
Lighthouse","": "","modified": "2.02E+16","Name": "Ailsa Craig
Lighthouse","Area": "Ayrshire","Lat": "55.2521","Long":
"5.108716667","Island_mainland": "Ailsa Craig","Year_built":
"1886","Built_by": "Thomas & David A Stevenson","Operated_by":
"NLB","Tower_height": "11m","Focal_height": "18m","Range": "17 nm"},
{"created": "2.02E+16","text": "","Tags": "","Title": "Ardnamurchan
Lighthouse","": "","modified": "2.02E+16","Name": "Ardnamurchan
Lighthouse","Area": "Highland","Lat": "56.72716667","Long":
"6.226116667","Island_mainland": "mainland","Year_built":
"1849","Built_by": "Alan Stevenson","Operated_by": "NLB","Tower_height":
"35m","Focal_height": "55m","Range": "24 nm"},
{"created": "2.02E+16","text": "","Tags": "","Title": "Auskerry","":
"","modified": "2.02E+16","Name": "Auskerry","Area": "Orkney
Islands","Lat": "59.02595","Long": "2.572783333","Island_mainland":
"Auskerry","Year_built": "1867","Built_by": "David & Thomas
Stevenson","Operated_by": "NLB","Tower_height": "34m","Focal_height":
"34m","Range": "18 nm"}
]

On import nothing happens!

Any explanation?

Rob

On Mon, 22 Jun 2020 at 01:12, Eric Shulman <[email protected]> wrote:

> On Sunday, June 21, 2020 at 3:27:20 PM UTC-7, Robert Jopling wrote:
>>
>> I am a newbie to TW5 and JSON so please can you explain how I achieve
>> that. The JSON file was an export from a database app.
>>
>
> To *export* tiddlers from TiddlyWiki using JSON format (go to
> $:/AdvancedSearch -> Filters tab, and enter a list of tiddlers, then press
> the "export" button and choose JSON format)
>
> The result is a file with contents like this:
> [
>    {
>      "created":"20200621234617853",
>       "text":"",
>       "tags":"",
>       "title":"TiddlerOne",
>       "modified":"20200621234625900"
>    },
>    {
>       "created":"20200621234629958",
>       "text":"",
>       "tags":"",
>       "title":"TiddlerTwo",
>       "modified":"20200621234637103"
>    },
>    {
>       "created":"20200621234639688",
>       "text":"",
>       "tags":"",
>       "title":"Tiddler Three with spaces",
>       "modified":"20200621234652570"
>    }
> ]
>
> You can then take that file and drag-and-drop it into another TiddlyWiki
> and you will be prompted to import all three tiddlers.
>
> Note that you don't actually need *all* those fields in the JSON file.
> You can actually get away with this minimal JSON:
> [
>    {
>       "title":"TiddlerOne"
>    },
>    {
>       "title":"TiddlerTwo"
>    },
>    {
>       "title":"Tiddler Three with spaces"
>    }
> ]
>
> However... while this minimal JSON can be imported into TiddlyWiki, it
> lack a few fields that make things work better.  Specifically, because the
> tiddler in this JSON file don't have any "created" or "modified" fields
> defined, they won't initially show up in the Recent tab in the TW sidebar
> (they can still be found by using the "More > All" tab in the sidebar).
>
> To make things work well right from the start, here's what I consider to
> be an effective minimal JSON file:
> [
>    {
>       "created":"20200621234617853",
>       "title":"TiddlerOne",
>       "modified":"20200621234625900"
>    },
>    {
>       "created":"20200621234629958",
>       "title":"TiddlerTwo",
>       "modified":"20200621234637103"
>    },
>    {
>       "created":"20200621234639688",
>       "title":"Tiddler Three with spaces",
>       "modified":"20200621234652570"
>    }
> ]
>
> Note that each tiddler has both a "created" and "modified" field defined.
> The timestamp format for these fields is:
> YYYY0MM0DD0hh0mm0ss0XXX
>
> That is:
> 4 digit year
> 2 digit month
> 2 digit day
> 2 digit hours
> 2 digit minutes
> 2 digit seconds
> 3 digit millisecond
>
> Note that all values (except for the year) are zero-padded... i.e., July
> 4th 2020 at 12:15:30pm would be: "20200704121430000"
>
> For your purposes, you could just use midnight on the current day, i.e.
> "20200621000000000".
>
> Also, as already noted by John Edwards, field names cannot have spaces,
> but can have underscores instead, so you will have to fix that as well.
>
> Hopefully, the above info is enough to get your data successfully imported
> as tiddlers.
>
> Let me know how it goes...
>
> enjoy,
> -e
> Eric Shulman
> TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
> InsideTiddlyWiki: http://TiddlyTools.com/InsideTW
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/a766e2f7-d65f-44ae-bb4b-d645d13baa49o%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/a766e2f7-d65f-44ae-bb4b-d645d13baa49o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAJCYWCvFRXs5mT6d80ALeMFc9CbUaLrA-KYpr6xVEed-A%2BCLDw%40mail.gmail.com.

Reply via email to