Find JSON in a big text [closed]

I’m wondering how you would find JSON part in a text that contain also normal text.
My use case is that I use ChatGPT (via API) to generate JSON but sometimes it “like” to add explainations.

Here is an example :

Here's a sample JSON object for Paris coordinates:
{
  "country": "France",
  "capital": "Paris",
  "lat": 48.8566,
  "lng": 2.3522
}

Explanation:

    "country" key holds the value of the country name.
    "capital" key holds the value of the capital city name.
    "lat" key holds the value of the latitude coordinate of Paris.
    "lng" key holds the value of the longitude coordinate of Paris.

Please note that this is just a sample JSON object and there could be more information added depending on your specific requirements.

The part that I need is :

{
  "country": "France",
  "capital": "Paris",
  "lat": 48.8566,
  "lng": 2.3522
}

Do you know a method or a library that could extract that JSON for me ? (in PHP)
I know that I could refine my initial query to ChatGPT to no explain anything.
But I prefer to be prepare against eventual strings added in the output.