How to treat json result, as if it were a Repo.all "Where"

I have a little doubt.

I’m trying to get a specific json id.
But I can not.
can you help me?

Type:
When there is a query in the database, I use it like this:

    testes = Teste
    |> order_by([c], asc: c.id)
    |> where([c], c.user_id == ^user_id)
    |> Ecto.Query.preload(:user)
    |> Repo.all

And in json, without any query in the database, how do I do it?

[       
  %{
    command: "test",
    created: 1584399425,
    hostconfig: %{networkmode: "test"},
    id: "test",
    image: "test",
    imageid: "test",
    labels: %{
      addressweb: "testsdad",
      user_id: 1
    },
    mounts: [],
    names: ["/test"],
    networksettings: %{
      networks: %{
        test_default: %{
          aliases: nil,
          driveropts: nil,
          endpointid: "test",
          gateway: "test",
          globalipv6address: "",
          globalipv6prefixlen: 0,
          ipaddress: "test",
          ipamconfig: nil,
          ipprefixlen: 16,
          ipv6gateway: "",
          links: nil,
          macaddress: "test",
          networkid: "test"
        }
      }
    }, 
    ports: [%{privateport: 80, type: "tcp"}],
    state: "test",
    status: "test"
  }
]

Hi @gilbertosj, Try some functions in the https://hexdocs.pm/elixir/Enum.html module. Show what you try here and we can provide feedback.

2 Likes