Ajax and Kirby - JSON url

Hi there.

I’m trying to figure out how Kirby works with Json… (this is all quite new to me).

I have a page “About” (parent) and in that page I made a child page “Sebastien” (child).
I want to get JSON structure from “Sebastien” page.

When I go to this link: http://localhost:8888/website/about.json/page:about/sebastien
I don’t see any JSON structure, I just see a full rendered HTML page of “Sebastien”.

Am I doing something wrong?
How can I make a proper JSON url and add a parameter / variable (“sebastien”)?

Looks like we are taking about a json representation here. But the URL looks weird. For which page have you created the representation? What is inside that representation?

I think I made a representation for the about page (template, json, js).
I also have a snippet (php/html) which would render “Sebastien”.

So how do I create a proper URL?

This is a piece of code I found on the Kirby docs:

let url = ${window.location.href}.json/page:${page};

I just noticed this article as well: Generating JSON with Kirby | Kirby

But this looks way too advanced for me. Case closed, I’ll solve it in another way.

Yes, but in your case, you are not using pagination, therefore you don’t want the page parameter.