- JSON-LD can be relatively straightforward to write
for small snippets, but for larger content or content
that relies on more than one vocabulary type
automatic JSON-LD generators can save you a lot of time.
Generators still rely on you to identify the content
that corresponds to each key.
But they generally provide an interface
for common vocabulary types, where you can enter your data
and then they generate
the resulting JSON-LD snippet for you.
H + Sport is hosting a 5K training run.
The event will be listed online,
and I want to create a JSON-LD snippet to make it easier
for search engines and event aggregators
to identify the relevant information and show it to people
who might be interested.
I haven't created JSON for this event and I'm going to try
creating the JSON-LD directly using a generator.
I found this JSON-LD generator using a web search,
but if you have any trouble opening it,
just search for generate JSON-LD in a search engine
and identify a tool from the results.
This generator supports
a number of common categories of information.
There's an event option, so I'll select that.
On the left I have fields where I can enter my information
and on the right is JSON-LD code based on the form.
I can see that the event type
is already part of the snippet.
There's also a nested location array that includes
a separate virtual location data type.
In the files for this video,
I have an empty 5ktraining.jsonld file,
where I'm going to put my generated JSON-LD snippet.
I also have a 5ktraining.txt file,
which contains the text from the flyer.
I'll use that to add content to the generator.
So first up is the event name.
And in my text, I have the event name, 5k training run.
So I'll paste that in.
Once I paste that in, I can see that over here,
the name field is populated with the values pasted in.
The description is also part of my flyer.
So we'll copy that and paste it.
And that's generated over here as well.
Now I don't have data that corresponds
to all the suggested fields here.
For instance, I don't have an image URL.
For attendance mode, I have the choices
of online, offline, or mixed.
And this is definitely going to be an offline event.
It's not going to be online it's a training run.
And the status is scheduled.
So I have room to specify the start date and time
and the end date and time.
So my start date is June 13th, the end dates the same,
and I have a little calendar widget here
I can use to select that.
Can actually use any date here.
That's not super important just for trying this out,
but let's go ahead and say June 13th
for the start date and for the end date.
And this is 12 noon to 2:00 o'clock PM.
So for the start time, I need to use a 24 hour format.
So that's going to be 12:00 and for the end time
that's going to be 14:00 for 2:00 o'clock PM.
The last thing I need to enter is the location.
It's the last piece of information on my flyer
that I haven't entered.
So I'm going to copy that location Ramsett Park
and put that in the location name.
And now I've generated all of the JSON-LD
for all of the information about my event.
Each of the pieces of information I have has been tagged
with one of the key names for the schema.org event type.
And so next I want to copy my JSON-LD code and paste it
over into my file.
Now this generator automatically generates opening
and closing script tags for an HTML file,
but we're not putting this in HTML.
We're going to keep this as just a JSON-LD snippet.
So I want to copy everything except for the first
and last line here.
Everything but those opening and closing script tags.
I'll copy that to the clipboard.
And then over in my editor, in my 5ktraining.json.ld file,
I'm going to paste in that code.
Now I do notice that down here in the location section,
I have all this information about the address that I haven't
actually filled in.
I just gave a name of a location.
And so I'm just going to go ahead and take out this entire
address section because it's not necessary for my data.
And it doesn't really add much.
And I need to take out the comma after Ramsett Park,
because it's the last key in this sub object.
And I'm going to save.
And that is my completed JSON-LD snippet.
Using the generator I was able to create a JSON-LD snippet
for somewhat complex data without a lot of work.
So that was a really great time saver.
And now I'm ready to share this snippet wherever I need to.