Having issues when referencing property keys that have periods/full stops in them...

106 views
Skip to first unread message

James Borkowski

unread,
Nov 13, 2013, 10:19:48 AM11/13/13
to ticktick...@googlegroups.com
Hi there,

I am having issues when trying to parse the following JSON:

{
  "bootstrap" : {
    "healthy" : true
  },
  "helloService.checkGreetingHealthCheck" : {
    "healthy" : true,
    "message" : "Greeting set to Hello"
  }
}

The issue specifically relates to trying to grab values of property keys that contain '.'s, e.g.  "helloService.checkGreetingHealthCheck", despite the fact that it is surrounded by double quotes, it is not accessible with '.', but, if I change it so that it is  "helloService-checkGreetingHealthCheck" then all works great!  I am guessing that it is trying to find checkGreetingHealthCheck as a sub-node of helloService, but don't think it should as it is quoted.  Do you know if this is something that can be fixed without too much trouble?

I have tried:
echo " `` "helloService.checkGreetingHealthCheck" ["message"] `` "
echo " ``"helloService.checkGreetingHealthCheck" ["message"] `` "
echo " `` "helloService.checkGreetingHealthCheck" ["message"]`` "
echo " `` "helloService.checkGreetingHealthCheck"["message"] `` "
echo " ``"helloService.checkGreetingHealthCheck"["message"] `` "
echo " `` "helloService.checkGreetingHealthCheck"["message"]`` "
echo " `` "helloService.checkGreetingHealthCheck"["message"]``"
echo " ``"helloService.checkGreetingHealthCheck"["message"]``"
echo "``"helloService.checkGreetingHealthCheck"["message"]``"
echo ``"helloService.checkGreetingHealthCheck"["message"]``
echo ``"helloService\.checkGreetingHealthCheck"["message"]``

Incidentally, I can't run ticktick from my Mac but on Linux it works great!  I am running generally with bash v3 and it appears to work flawlessly!

Would just like to say that it is a very impressive use of undocumented features to bring OO to the shell!  Really like what you have done!

Many thanks for any help that you may be able to bring!!

Chris McKenzie

unread,
Nov 13, 2013, 11:55:39 AM11/13/13
to ticktick...@googlegroups.com
Replies below:

On 11/13/2013 07:19 AM, James Borkowski wrote:
> Hi there,
>
> I am having issues when trying to parse the following JSON:
>
> {
> "bootstrap" : {
> "healthy" : true
> },
> "helloService.checkGreetingHealthCheck" : {
> "healthy" : true,
> "message" : "Greeting set to Hello"
> }
> }
>
> The issue specifically relates to trying to grab values of property
> keys that contain '.'s, e.g. "helloService.checkGreetingHealthCheck",
> despite the fact that it is surrounded by double quotes, it is not
> accessible with '.', but, if I change it so that it is
> "helloService-checkGreetingHealthCheck" then all works great! I am
> guessing that it is trying to find checkGreetingHealthCheck as a
> sub-node of helloService, but don't think it should as it is quoted.
> Do you know if this is something that can be fixed without too much
> trouble?
The dot is certainly a problem. You should probably do away with it.
I'll look to see if I can support it today after work.

>
> I have tried:
> echo " `` "helloService.checkGreetingHealthCheck" ["message"] `` "
> echo " ``"helloService.checkGreetingHealthCheck" ["message"] `` "
> echo " `` "helloService.checkGreetingHealthCheck" ["message"]`` "
> echo " `` "helloService.checkGreetingHealthCheck"["message"] `` "
> echo " ``"helloService.checkGreetingHealthCheck"["message"] `` "
> echo " `` "helloService.checkGreetingHealthCheck"["message"]`` "
> echo " `` "helloService.checkGreetingHealthCheck"["message"]``"
> echo " ``"helloService.checkGreetingHealthCheck"["message"]``"
> echo "``"helloService.checkGreetingHealthCheck"["message"]``"
> echo ``"helloService.checkGreetingHealthCheck"["message"]``
> echo ``"helloService\.checkGreetingHealthCheck"["message"]``
>
> Incidentally, I can't run ticktick from my Mac but on Linux it works
> great! I am running generally with bash v3 and it appears to work
> flawlessly!
Really? What's your OSX (I assume) version?

~chris.
>
> Would just like to say that it is a very impressive use of
> undocumented features to bring OO to the shell! Really like what you
> have done!
>
> Many thanks for any help that you may be able to bring!!
> --
> You received this message because you are subscribed to the Google
> Groups "TickTick" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ticktick-proje...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

James Borkowski

unread,
Nov 14, 2013, 7:56:53 AM11/14/13
to ticktick...@googlegroups.com
Hey Chris,

Many thanks for taking the time to reply to me!! It is MOST appreciated!  Along with your great contribution to the open source community!  This is a really clever little hack!  I like it a lot!  I have been needing a way to bring some hierarchical data structures and oo functionality a little closer to the shell and this library really excites me!

Apologies for posting on another ticket.  I appended to that before I saw this response.  Repeating here for clarity; in response to the Magic String anti-pattern issue, I understand the following:

a.b.c would reference sub-property c of sub-entity b of entity a
"a.b".c would reference sub-property c of entity "a.b"

Does this make sense?  Is quoting like this a sensible way of specifying that things with a dot are part of the same "thing"?  This is what the dev team I am working with are telling me, but I also can see how using dots, at the least, can add confusion.

Apologies if I am using the wrong terminology or angle, just trying to help and I am a build/release/CM guy, not a developer per-sae so If I am barking up the wrong tree please excuse my madness :)  I am trying to help come up with a sensible solution but so far have not been able to get my head around the code enough to try and make it respect this.

Anyway, thanks again for any help that you may offer.  I really appreciate it along with all the work you have done on this in the past!!

Kind regards,

James


To unsubscribe from this group and stop receiving emails from it, send an email to ticktick-project+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "TickTick" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ticktick-project/CbOZjQ0RGmc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ticktick-project+unsubscribe@googlegroups.com.

Chris McKenzie

unread,
Nov 14, 2013, 8:26:22 AM11/14/13
to ticktick...@googlegroups.com
replies below:


On 11/14/2013 04:56 AM, James Borkowski wrote:
Hey Chris,

Many thanks for taking the time to reply to me!! It is MOST appreciated!  Along with your great contribution to the open source community!  This is a really clever little hack!  I like it a lot!  I have been needing a way to bring some hierarchical data structures and oo functionality a little closer to the shell and this library really excites me!
I'm flattered. But this entire thing is a monstrous hack.


Apologies for posting on another ticket.  I appended to that before I saw this response.  Repeating here for clarity; in response to the Magic String anti-pattern issue, I understand the following:

a.b.c would reference sub-property c of sub-entity b of entity a
"a.b".c would reference sub-property c of entity "a.b"

Does this make sense?  Is quoting like this a sensible way of specifying that things with a dot are part of the same "thing"?  This is what the dev team I am working with are telling me, but I also can see how using dots, at the least, can add confusion.
This system rewrites your bash script.  It isn't a "valid" full json implementation.  This feature you speak of *can* be supported.  I'd have to re-encode strings as something that involves a smaller character set; base*62* comes to mind ([A-Za-z0-9]).  This would make the outputted bash code cryptic and hard to human-read, but it *would indeed* support your feature.

Apologies if I am using the wrong terminology or angle, just trying to help and I am a build/release/CM guy, not a developer per-sae so If I am barking up the wrong tree please excuse my madness :)  I am trying to help come up with a sensible solution but so far have not been able to get my head around the code enough to try and make it respect this.
Alright, let me be clear. The code, as it stands, certainly can not do what you want.  I'll have to modify it and actually start versioning and doing release notes if you want that.  I can do that, but it will unfortunately be on /my/ time.

~chris.
To unsubscribe from this group and stop receiving emails from it, send an email to ticktick-proje...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "TickTick" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ticktick-project/CbOZjQ0RGmc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ticktick-proje...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "TickTick" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ticktick-proje...@googlegroups.com.

Chris McKenzie

unread,
Nov 25, 2013, 9:34:07 PM11/25/13
to ticktick...@googlegroups.com
Howdy. I've written the test for this case in this commit: https://github.com/kristopolous/TickTick/commit/19640c31c22c15ce64ef960d9a9f51fabcf4be13

It currently fails it.  I'd like to probably write some more sanity tests before I do this change, because it will be a core modification.

James Borkowski

unread,
Nov 26, 2013, 6:32:49 AM11/26/13
to ticktick...@googlegroups.com
Thank you so much for looking at this in your own time!  It is really appreciated!

Can I do anything to help?

If you want me to, I could write some more tests or anything you see could help?  I don't know if it would be a case of too many cooks spoiling the broth, but if it would help then I will do anything I can to help.  So, please let me know if there is anything... :-)

Kind regards,

James


--

Christopher McKenzie

unread,
Nov 27, 2013, 1:40:19 PM11/27/13
to ticktick...@googlegroups.com

Nothing right now. I'll try to get to it over the holiday break.

You received this message because you are subscribed to the Google Groups "TickTick" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ticktick-proje...@googlegroups.com.

Chris McKenzie

unread,
Nov 30, 2013, 11:50:17 AM11/30/13
to ticktick...@googlegroups.com
Hi.

So if you haven't been following the issue tracker, I closed #29 and opened #30 which deals with the more generalized "things inside a string" problem that should be solved with the period problem.  It looks like the logic that I'm building for solving #29 will be generally useful for this.  I'll address #29 first though.  Thanks

~chris.

To unsubscribe from this group and all its topics, send an email to ticktick-project+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "TickTick" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ticktick-project+unsubscribe@googlegroups.com.

Chris McKenzie

unread,
Nov 30, 2013, 5:31:02 PM11/30/13
to ticktick...@googlegroups.com
Alright. Everything should be fixed. Please test.

Chris McKenzie

unread,
Dec 9, 2013, 1:05:40 PM12/9/13
to ticktick...@googlegroups.com
How goes it? Did everything work out for you?
Reply all
Reply to author
Forward
0 new messages