Help needed on parsing dict. data

Mathieu LENGAGNE's icon

Hello everyone.

I'm trying to receive some NASA data via their API using maxurl. So far so good, I can get the data I want. But I'm struggling to get some of the dict content. I get all keys of my subDict with a getkeys message but when I send the message "get close_approach_data::close_approach_date_full" I have the error "dict: no dictionary named close_approach_data, cannot get value" even if I got the key from a "getkeys" message.

I think I'm getting confused on dict data format : some are arrays, some are dictionaries, other are just messages.

So my basic question is : what am I doing wrong here ?

Thanks in advance for your time :)



NASA DATA.zip
zip

yaniki's icon

Hello MATHIEU

Try this approach:

nasa.zip
zip

I hope this solves the problem (it works for me) ;-)

It's an old JS script, I wrote for myself. The script converts the entire contents of the dict into series of messages that it names appropriately - you can filter out unnecessary ones or modify the script to suit your needs (it's old, so it still requires some polishing).

Mathieu LENGAGNE's icon

Hello Yaniki,

Thanks for you message ! Then fun thing is that your parser was already in my patch haha ! But I was looking for a more convienient approch with only max objects. It's also an opportunity to learn something new ! I'm sure there is a workaround without parsing all dict data as individual messages. But if there are not, your parser will be my saver, so thanks !

EDIT : the main problem with your solution is also the fact that the whole dict path is concatenated as one symbol, then only the value is a second list item. I'm sure I can use the new strings object to work around that without using lots of sprintf objects or js, but I'm also still not familiar with them. I'll have a look.

yaniki's icon

Yep, this parser is circulating between people - well... - parsing data from [maxurl]. It seems like no one likes it or wants (including me), but it's quite hard to replace it. But it's possible, I suppose.