|
To stoke the fires of passion? Things could get smutty...
|
|
|
|
|
Does it soot her?
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
You could also get her a Carbon, that is, a good Cajun vehicle. Her nic-name wouldn't be Newcastle, would it?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Let's say you wanted to write a fast JSON parser.
You could do a pull parser that does well-formedness checking
Or you could do one that's significantly faster but skips well formedness checking during search/skip operations, which can lead to later error reporting or missed errors
You can't make an option to choose one or the other, but you can avoid using the skip/search functions that do this in the latter case.
Which do you do? Are you a stomp-the-pedal type or a defensive driver? (Seriously, this is more about getting a read of the room than anything - I want a feel for priorities)
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: Which do you do? Use NewtonSoft's.
|
|
|
|
|
Fortunately I'm not allowed to use third-party add-ins.
I am awaiting access to the JSON support built into .net 4.7 and newer to see whether or not it can do what I require.
|
|
|
|
|
JSON.NET, along with a large number of OSS projects, has been given to the .NET Foundation Projects.
This might reduce your company's reluctance to use it, plus the fact that until recently, JSON.NET was the package that Microsoft was using in their OSS projects (.NET Core, ASP.NET Core, ...).
Also, System.Text.Json, the new MS JSON support, is a NuGet package, not part of the framework, and can be used as far back as .NET 4.6.1.
"Time flies like an arrow. Fruit flies like a banana."
|
|
|
|
|
Yeah, no, we can't deploy any third-party stuff to the servers, it has to be either build-in .net or stuff we implement.
|
|
|
|
|
Whilst I can understand there may be restrictions on simply downloading (or worse simply referencing an external 3rd party site), surely there is a mechanism to obtain an external library under controlled circumstances?
Personally I see it no different than choosing a piece of off-the-shelf software. Go through the standard checks you would do before deploying any other 3rd party piece of software and you'd be fine.
I've written parsers in the past (albeit XML). I spent weeks accounting for our specific use case scenario, it wasn't even fully featured. All it would take was the external source of the XML to decide to implement something that my parser hadn't included and the system would have fallen over.
So I would be going to your higher-ups with the following three arguments.
1. A custom JSON parser is likely to take weeks to develop and test
2. A custom JSON parser has potential to not correctly implement the full set of JSON rules, thus would be a risk to the project.
3. Evaluating JSON parser options for suitability and security would be a quicker, cheaper, and potentially more secure option than attempting to build your own parser (since it's is possible to embed executable code into JSON)
|
|
|
|
|
In theory, sure, but no, it's even worse than that.
For instance, we used to use the .net provider for MySQL, but then the server and desktop approval teams couldn't agree on which version to approve -- leaving us with no way to develop an application which would work when deployed to the servers.
|
|
|
|
|
Ah, yes, I can relate to that sort of silliness.
|
|
|
|
|
|
I think so, but until I see it, I can't tell.
|
|
|
|
|
If you're allowed to upgrade to .NET 5, they effectively implemented Newtonsofts one natively with pretty much the identical syntax. Works really well, and you're not using third-party add-ins.
-= Reelix =-
|
|
|
|
|
Yup, looking forward to it. Not holding my breath.
It doesn't help that my boss read a blog that said that Microsoft is abandoning .net ( ). Middle-managers will believe anything if it's in a blog.
I countered with a link to Microsoft's road map for the future of .net, but the damage was already done.
|
|
|
|
|
I already told you a bit about mine. It's probably a bit permissive.
I think your assumption of "search/skip operations" is not one which most others will even consider.
I assume that most would not implement either of those, but instead want to have the whole entire document, because why else would you be parsing the thing anyway?
As to well-formedness checking -- "You Ain't Gonna Need It" (the same as with XML).
In my case, I had to "stomp-the-pedal" because I was given a short deadline to have a working solution for reading JSON files (75GB worth) and loading the data into SQL Server.
|
|
|
|
|
PIEBALDconsult wrote: I assume that most would not implement either of those, but instead want to have the whole entire document, because why else would you be parsing the thing anyway?
In my JSON on Fire[^] article I present several cases where you only need a little data from a much larger dataset.
Consider querying any mongoDB repository online. You don't need to parse everything you get back because the data they return is very large grained/chunky. You don't get fine grained query results with it. You get kilobytes of data at least, and on an IoT device you may just not have the room.
The show information for Burn Notice from tmdb.com is almost 200kB. I know that because I'm using it as a test data set.
Real programmers use butterflies
|
|
|
|
|
My needs are simple -- some other team sends us some number of JSON files and I need to load the data into SQL Server.
In most cases, each JSON file contains one "table" of data so loading it into a table is simple.
At most I may want to filter out large binary values which are of no use to us.
And we trust the sender to have provided well-formed JSON -- if it isn't, we find out real fast and throw it back to them to fix.
Well-formedness is one of those things you shouldn't be concerned about once you get your application to PROD.
At this time, I'm consuming two sets of files from third-party products which those products also have to be able to read -- they're the configuration files for those products.
The only untrustworthy set of data I consume is one which is generated by a utility I wrote, so if it's broken it's my fault and I can fix it.
|
|
|
|
|
This lib i wrote was originally in C# and I ported it. I originally designed it (the C# version) to do bulk loads of data - basically exactly what you're doing but perhaps a lot more of it.
Real programmers use butterflies
|
|
|
|
|
Whichever lets me stream the file into a database, without clogging any system resources.
Wrong is evil and must be defeated. - Jeff Ello
Never stop dreaming - Freddie Kruger
|
|
|
|
|
I would want the "text" of the JSON to be well-formed (proper braces, quotes, commas, colons, brackets, etc.) but as the to the contents, whether they map or not to the backing entity doesn't much matter, though obviously things would break of a collection is expected and it's not a collection, or vice-versa. Same with automatic data type conversion.
So, yeah, basically I would want the "defensive driver" approach.
|
|
|
|
|
So if it wasn't, you'd like to error as soon as you catch it, even if it meant a slower parse is what I'm hearing.
Real programmers use butterflies
|
|
|
|
|
|
It depends on context, of course.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
I barely ever use JSON and have never written (nor am I likely to) a parser, but what I do know is that I can't answer a question like this without knowing the context.
- Is it more important to be fast 100% of the time and permit errors 1% of the time, or to be 100% reliable at the cost of a few percentage points in speed? (i.e. how critical is the data, and how critical is speed? This is a pretty common trade-off)
- Is the data coming from another system I / we have written, or a trusted partner, or from Joe Public? Is the data machine generated or hand-crafted?
|
|
|
|