Papillon6814

Papillon6814

Convert charlist to string recursively

Hello. I need help from you :sob: :sob:
First of all, I have a return value from the neo4j database like this:

%{
  'records' => [
    %{
      'category' => 'NODE',
      'id' => 83,
      'key' => 'm',
      'labels' => ['Match'],
      'properties' => %{'bracket_id' => 1, 'depth' => 1}
    }
  ],
  'results' => %{
    'm' => %{
      'category' => 'NODE',
      'id' => 83,
      'key' => 'm',
      'labels' => ['Match'],
      'properties' => %{'bracket_id' => 1, 'depth' => 1}
    }
  }
}

The type of keys and values are charlist, not string(sometimes the value is integer though). I’d like to convert those charlist keys and values into string all!
Then, the data I want is like this:

%{
  "records" => [
    %{
      "category" => "NODE",
      "id" => 83,
      "key" => "m",
      "labels" => ["Match"],
      "properties" => %{"bracket_id" => 1, "depth" => 1}
    }
  ],
  "results" => %{
    "m" => %{
      "category" => "NODE",
      "id" => 83,
      "key" => "m",
      "labels" => ["Match"],
      "properties" => %{"bracket_id" => 1, "depth" => 1}
    }
  }
}

I think I have to make a function that converts charlist into string recursively, but I don’t have an implementation idea. Because I’d like to convert only charlist, not all list. Please help me if you have a solution for it. Thank you.

First Post!

hauleth

hauleth

How you want to differentiate between [42] and '*'? Maybe look for another Neo4j driver that would use binaries instead of charlists?

Most Liked

Sebb

Sebb

for python3 erlport does:

str -> list
bytes -> binary

wonder why they chose that…

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New

We're in Beta

About us Mission Statement