How to filter out Non Json objects in property test using streamdata

I’m running a property test to test a diffing library (JsonDiffEx) and I’m using streamdata to generate the data. How would I go about generating these? Currently using this but term() generates some types that are not accepted by JSON

property "when a & b are arbitrary json objects; patch(a, diff(a,b)) == b" do
    check all(
            map_a <- map_of(term(), term()),
            map_b <- map_of(term(), term())
          ) do

            IO.inspect(" This is map a #{inspect(map_a)}")
            IO.inspect("This is map b #{inspect(map_b)}")

      assert map_b == JsonDiffEx.patch(map_a,JsonDiffEx.diff(map_a, map_b))
    end
  end
end


And get this exception. When I got this I tried to do one_of and choosing the types but I got a too many duplicates exception. How should I go about this ? Thank you in advance

 ** (Protocol.UndefinedError) protocol String.Chars not implemented for #Reference<0.3189691871.3129475073.18187> of type Reference. This protocol is implemented for the following type(s): Atom, BitString, Date, DateTime, Decimal, ExJsonSchema.Validator.Error.AdditionalItems, ExJsonSchema.Validator.Error.AdditionalProperties, ExJsonSchema.Validator.Error.AllOf, ExJsonSchema.Validator.Error.AnyOf, ExJsonSchema.Validator.Error.Const, ExJsonSchema.Validator.Error.Contains, ExJsonSchema.Validator.Error.ContentEncoding, ExJsonSchema.Validator.Error.ContentMediaType, ExJsonSchema.Validator.Error.Dependencies, ExJsonSchema.Validator.Error.Enum, ExJsonSchema.Validator.Error.False, ExJsonSchema.Validator.Error.Format, ExJsonSchema.Validator.Error.IfThenElse, ExJsonSchema.Validator.Error.ItemsNotAllowed, ExJsonSchema.Validator.Error.MaxItems, ExJsonSchema.Validator.Error.MaxLength, ExJsonSchema.Validator.Error.MaxProperties, ExJsonSchema.Validator.Error.Maximum, ExJsonSchema.Validator.Error.MinItems, ExJsonSchema.Validator.Error.MinLength, ExJsonSchema.Validator.Error.MinProperties, ExJsonSchema.Validator.Error.Minimum, ExJsonSchema.Validator.Error.MultipleOf, ExJsonSchema.Validator.Error.Not, ExJsonSchema.Validator.Error.OneOf, ExJsonSchema.Validator.Error.Pattern, ExJsonSchema.Validator.Error.PropertyNames, ExJsonSchema.Validator.Error.Required, ExJsonSchema.Validator.Error.Type, ExJsonSchema.Validator.Error.UniqueItems, Float, Integer, List, NaiveDateTime, Phoenix.LiveComponent.CID, Postgrex.Copy, Postgrex.INET, Postgrex.MACADDR, Postgrex.Query, Time, URI, Version, Version.Requirement
     code: check all(
     stacktrace:
       (elixir 1.13.2) lib/string/chars.ex:3: String.Chars.impl_for!/1
       (elixir 1.13.2) lib/string/chars.ex:22: String.Chars.to_string/1
       (elixir 1.13.2) lib/enum.ex:3828: Enum.join_non_empty_list/3
       (elixir 1.13.2) lib/enum.ex:4109: Enum.join_list/2
       (json_diff_ex 0.6.6) lib/json_diff_ex.ex:320: JsonDiffEx.correct_lists/2
       (json_diff_ex 0.6.6) lib/json_diff_ex.ex:294: JsonDiffEx.do_patch_merge/3
       (elixir 1.13.2) lib/map.ex:617: Map.update/4
       (stdlib 3.17) maps.erl:410: :maps.fold_1/3
       (json_diff_ex 0.6.6) lib/json_diff_ex.ex:288: JsonDiffEx.do_patch/2
       test/hidden/hidden/difftesting_test.exs:15: anonymous fn/3 in DifftestingTest."property when a & b are arbitrary json objects; patch(a, diff(a,b)) == b"/1
       (stream_data 0.5.0) lib/stream_data.ex:2148: StreamData.shrink_failure/6
       (stream_data 0.5.0) lib/stream_data.ex:2108: StreamData.check_all/7
       test/hidden/Hidden/difftesting_test.exs:7: (test)```

The keys in a JSON object are only allowed to be strings, none of these are valid JSON:

{true:"foo"}
{null:"foo"}
{5:"foo"}