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?

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
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
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
Kagamiiiii
Student & New to elixir. Nice language. I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
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
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
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

We're in Beta

About us Mission Statement