Skip to content

JSON string to GAMA map #72

Closed Answered by ivan-majic
ivan-majic asked this question in Q&A
Nov 29, 2022 · 0 comments · 7 replies
Discussion options

You must be logged in to vote

If anyone runs into a similar issue, I managed to create the map like I wanted by sending a nested list string to GAMA, evaluating it with GAMA's eval function and then creating a map using two lists (1st for keys and 2nd for values).

Here is the string I sent from Python:
'[["people3", "people5"],[ "Festungsbahn Talfahrt XML","Final"]]'

The code I ran in GAMA to create a map object:

list<list<string>> response_list <- eval_gaml(mess.contents);
map<string,string> response_map <- create_map(response_list[0], response_list[1]);
write 'Response map: ' + response_map;

OUTPUT:
Response_map: map(["people3"::"Festungsbahn Talfahrt XML", "people5"::"Final"])

That said, if there is an obvious wa…

Replies: 0 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@lesquoyb
Comment options

@ivan-majic
Comment options

Answer selected by ivan-majic
Comment options

You must be logged in to vote
1 reply
@ivan-majic
Comment options

Comment options

You must be logged in to vote
1 reply
@ivan-majic
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants