Click here to Skip to main content
15,886,664 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Hey JSOP! Pin
Jörgen Andersson23-Dec-20 2:41
professionalJörgen Andersson23-Dec-20 2:41 
GeneralRe: Hey JSOP! Pin
honey the codewitch23-Dec-20 2:42
mvahoney the codewitch23-Dec-20 2:42 
GeneralRe: Hey JSOP! Pin
Jörgen Andersson23-Dec-20 2:43
professionalJörgen Andersson23-Dec-20 2:43 
GeneralRe: Hey JSOP! Pin
honey the codewitch23-Dec-20 2:44
mvahoney the codewitch23-Dec-20 2:44 
GeneralRe: Hey JSOP! Pin
Jörgen Andersson23-Dec-20 2:45
professionalJörgen Andersson23-Dec-20 2:45 
GeneralRe: Hey JSOP! Pin
honey the codewitch23-Dec-20 2:47
mvahoney the codewitch23-Dec-20 2:47 
GeneralRe: Hey JSOP! Pin
Jörgen Andersson23-Dec-20 2:48
professionalJörgen Andersson23-Dec-20 2:48 
GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
PIEBALDconsult24-Dec-20 8:22
mvePIEBALDconsult24-Dec-20 8:22 
I can't deploy DLLs to the servers, so I basically can use only C# which I write myself. That and the ADO.net providers for Oracle and Teradata. Other than that, it has to be part of .net 4.6 -- though I hope we get at least 4.7 soon (as mentioned in another post).

I'm fine with my parser at this time, but I look forward to trying what Microsoft has once it's available to me -- it may prove faster, it may not, but at this time I have nothing against which to benchmark mine.


A sort of simplified diagram of the layers of my parser:
______________________________________________________________
|                                                            |
| Loop:                                                      |
|   Get the next token (JSONitem).                           |
|                                                            |
|   If the token is a value:                                 |
|     Unquote it and add it to the item on top of the stack. |
|                                                            |
|   If the token is the start of an object:                  |
|     Instantiate a new object.                              |
|     Add it the current item on top of the stack.           |
|     Push it onto the stack.                                |
|                                                            |
|   If the token is the start of an array:                   |
|     Instantiate a new array.                               |
|     Add it the current item on top of the stack.           |
|     Push it onto the stack.                                |
|                                                            |
|   If the token is the end of an object:                    |
|     Pop the current item off the stack.                    |
|     If a filter has been specified for the object:         |
|       Apply the filter (remove content).                   |
|                                                            |
|   If the token is the end of an array:                     |
|     Pop the current item off the stack.                    |
|                                                            |
|   Break the loop when the stack is empty                   |
|   or if the end-of-file is reached.                        |
|                                                            |
| Return the tree of tokens which represent the value.       |
| (Or NULL for end-of-file.)                                 |
|                                                            |
| Note:                                                      |
| This does not check to ensure that an end-of- matches the  |
| start-of- which is popped of the stack.                    |
|                                                            |
| Possibly, the filter could wait to be applied just before  |
| the tree is returned.                                      |
|                                                            |
|____________________________________________________________|
|                                                            |
| Get the next token (string).                               |
|                                                            |
| Peek the following (significant) character.                |
|                                                            |
| Is the following character a COLON?                        |
|   No : The token we just got is unnamed.                   |
|   Yes:                                                     |
|     The token we just read is the name of a value.         |
|     Discard the COLON.                                     |
|     Get the next token.                                    |
|                                                            |
| Return the (named or unnamed) token as a JSONitem.         |
| (Or NULL for end-of-file.)                                 |
|                                                            |
|____________________________________________________________|
|                                                            |
| Read the next character from the file and classify it as   |
| appropriate for the type of parse being performed:         |
|   normal, delimiter, etc.                                  |
|                                                            |
| Is the character part of the current token?                |
|   No : Return the current token.                           |
|   Yes: Add it to the current token (StringBuilder).        |
|                                                            |
| Note: This handles QUOTEs and ESCAPEs, throws away         |
| insignificant whitespace, and normalizes newlines.         |
|                                                            |
| This part of the parser is not JSON-specific, I also use   |
| it for CSV.                                                |
|                                                            |
|============================================================|
|                                                            |
| .net, TextReader for input file                            |
|                                                            |
|============================================================|

GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
honey the codewitch24-Dec-20 9:46
mvahoney the codewitch24-Dec-20 9:46 
GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
PIEBALDconsult24-Dec-20 10:53
mvePIEBALDconsult24-Dec-20 10:53 
GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
honey the codewitch24-Dec-20 11:54
mvahoney the codewitch24-Dec-20 11:54 
GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
PIEBALDconsult24-Dec-20 12:27
mvePIEBALDconsult24-Dec-20 12:27 
GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
honey the codewitch24-Dec-20 13:00
mvahoney the codewitch24-Dec-20 13:00 
GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
PIEBALDconsult24-Dec-20 13:34
mvePIEBALDconsult24-Dec-20 13:34 
GeneralRe: Hey JSOP! Whoops I mean PIEBALDconsult! Sorry! Pin
honey the codewitch24-Dec-20 15:48
mvahoney the codewitch24-Dec-20 15:48 
GeneralDilbert OTD: working from home problems Pin
OriginalGriff23-Dec-20 0:27
mveOriginalGriff23-Dec-20 0:27 
GeneralRe: Dilbert OTD: working from home problems Pin
rnbergren23-Dec-20 3:51
rnbergren23-Dec-20 3:51 
GeneralRe: Dilbert OTD: working from home problems Pin
Slow Eddie24-Dec-20 2:18
professionalSlow Eddie24-Dec-20 2:18 
GeneralRe: Dilbert OTD: working from home problems Pin
Kirk 1038982124-Dec-20 8:15
Kirk 1038982124-Dec-20 8:15 
GeneralThe weird issues and workarounds we sometimes have to deal with Pin
Jacquers22-Dec-20 21:37
Jacquers22-Dec-20 21:37 
GeneralRe: The weird issues and workarounds we sometimes have to deal with PinPopular
Jörgen Andersson23-Dec-20 0:45
professionalJörgen Andersson23-Dec-20 0:45 
GeneralRe: The weird issues and workarounds we sometimes have to deal with Pin
OriginalGriff23-Dec-20 0:47
mveOriginalGriff23-Dec-20 0:47 
GeneralRe: The weird issues and workarounds we sometimes have to deal with Pin
Jörgen Andersson23-Dec-20 2:55
professionalJörgen Andersson23-Dec-20 2:55 
GeneralRe: The weird issues and workarounds we sometimes have to deal with Pin
Jacquers23-Dec-20 0:53
Jacquers23-Dec-20 0:53 
GeneralRe: The weird issues and workarounds we sometimes have to deal with Pin
Jörgen Andersson23-Dec-20 2:52
professionalJörgen Andersson23-Dec-20 2:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.