Re: [PATCH 2/2] Generate correct json

2014-08-27 Thread Gehad Elrobey
On Wed, Aug 27, 2014 at 12:14 AM, Dirk Hohndel d...@hohndel.org wrote: On Tue, Aug 26, 2014 at 11:13:22PM +0300, Gehad Elrobey wrote: This is very useful thanks, I ll try to migrate the JSON exporter to this model. Yes, I think Linus' post was extremely useful. :-) I'd love to see a patch

Re: GSoC work priority? [Was: [PATCH 2/2] Generate correct json]

2014-08-27 Thread Lubomir I. Ivanov
On 27 August 2014 09:22, Paul-Erik Törrönen pol...@777-team.org wrote: So I think the better solution is to talk Gehad into doing it right when things are created. This raises (at least in my mind) the question about the GSoC work that is done this year on Subsurface. Specifically whether

Re: GSoC work priority? [Was: [PATCH 2/2] Generate correct json]

2014-08-27 Thread Dirk Hohndel
On Aug 27, 2014, at 3:42 AM, Lubomir I. Ivanov neolit...@gmail.com wrote: On 27 August 2014 09:22, Paul-Erik Törrönen pol...@777-team.org wrote: So I think the better solution is to talk Gehad into doing it right when things are created. This raises (at least in my mind) the question about

Re: [PATCH 2/2] Generate correct json

2014-08-27 Thread Dirk Hohndel
On Wed, Aug 27, 2014 at 10:27:30AM +0300, Gehad Elrobey wrote: On Wed, Aug 27, 2014 at 12:14 AM, Dirk Hohndel d...@hohndel.org wrote: On Tue, Aug 26, 2014 at 11:13:22PM +0300, Gehad Elrobey wrote: This is very useful thanks, I ll try to migrate the JSON exporter to this model. Yes,

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Salvo Tomaselli
Oh I found a bug with this: it needs to skip also \t. In data martedì 26 agosto 2014 19:56:20, Salvo 'LtWorf' Tomaselli ha scritto: Not quite the solution I'd want, but the json generation would need + //Skip whitespace + while (buf[i + inc] == ' ' ||

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Gehad Elrobey
I think this can be done easily by just checking if the item is the last item in the array before putting the commas. Also I think there are other 3rd party JSON parsers for python that can be more advanced and coup with the trailing commas. Regards, Gehad On Tue, Aug 26, 2014 at 9:08 PM, Dirk

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Dirk Hohndel
On Tue, Aug 26, 2014 at 09:24:41PM +0300, Gehad Elrobey wrote: I think this can be done easily by just checking if the item is the last item in the array before putting the commas. That would be my by far preferred solution. Let's just not put the wrong commas there. /D

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Linus Torvalds
On Tue, Aug 26, 2014 at 11:24 AM, Gehad Elrobey gehadelro...@gmail.com wrote: I think this can be done easily by just checking if the item is the last item in the array before putting the commas. So, quite frankly, you guys need to learn a very clean and simple model for outputting lists with

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Gehad Elrobey
This is very useful thanks, I ll try to migrate the JSON exporter to this model. Dirk: I think you have missed a patch that adds the divecomputer data to the exports. On Tue, Aug 26, 2014 at 10:02 PM, Linus Torvalds torva...@linux-foundation.org wrote: On Tue, Aug 26, 2014 at 11:24 AM, Gehad

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Dirk Hohndel
On Tue, Aug 26, 2014 at 11:13:22PM +0300, Gehad Elrobey wrote: This is very useful thanks, I ll try to migrate the JSON exporter to this model. Yes, I think Linus' post was extremely useful. :-) I'd love to see a patch that uses that pattern. Dirk: I think you have missed a patch that adds

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Dirk Hohndel
On Tue, Aug 26, 2014 at 11:08:56PM +0200, Salvo Tomaselli wrote: Hello, First, let me point out that the json parser of Python, rejecting because of the extra commas is not wrong. That's how the format is defined. I agree with you - we want to create correct JSON. I had started to fix the