Re: Re: RFC Idea - is_json - looking for feedback

From: Date: Sun, 07 Aug 2022 17:11:01 +0000
Subject: Re: Re: RFC Idea - is_json - looking for feedback
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-118366@lists.php.net to get a copy of this message
Hello Ollie. Dont be sorry. Actually I appreciate every feedback I got. I promise I Will not dissapoint anyone. I Will prepare de RFC next week. Regards. Juan El dom., 7 de agosto de 2022 14:03, Ollie Read <php@ollie.codes> escribió: > Hey, > > While I'm not opposed to the idea, I'm struggling to think of a way to > accurately determine whether a string is true JSON that doesn't involve > some sort of parsing. > > Sure some regexes can be run on it, but I'm not sure that will ever be > 100% accurate. Any parsing of the JSON to determine whether or not it's > valid JSON would, in most situations, lead down a code path that then > parsed the JSON again, essentially repeating the same function for little > benefit. > > I personally like to use the *JSON_THROW_ON_ERROR* flag on > json_decode. > > Not trying to rain on your parade, so sorry if it comes across that way, > I'm just not sure of a way to do it where the benefit outweighs the cons, > but then again, there are people a lot smarter than me on this list. > > --- > Best Regards, > *Ollie Read* >

« previous php.internals (#118366) next »