[FFmpeg-user] JSON writer Introduces malformed string when serializing usIng GSON

Moritz Barsnick barsnick at gmx.net
Thu Feb 13 12:52:11 EET 2020


On Thu, Feb 13, 2020 at 13:22:18 +0300, Otieno Rowland wrote:
> For some reason when I try to read some metadata which has some text with
> double quotes, FFprobe tries to escape them from "text here"  into \"text
> here\", which causes lots of problems on my side, as I unable to serialize
> the JSON properly when trying to convert to Java code.

Can you give a complete example of the metadata, as shown by "ffmpeg
-i" or "ffprobe" (without "-hide_banner", and without the other ffprobe
options), the JSON output, and what you are expecting, please?

Correct JSON *mandates* that certain characters be escaped, and double
quotes inside the (keys and) values most certainly *must* be escaped!

Assuming a value such as:

This text has "some" quotation marks

the correct JSON is:

"keyname": "This text has \"some\" quotation marks"

Cheers,
Moritz


More information about the ffmpeg-user mailing list