marshmallow-code / marshmallow-code/marshmallow

Dot in key is not parsed correclty on loads()

Open
#2,194 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
Python
Stars
7.2k
Forks
738
Avg merge
1d 23h
Merged PRs (30d)
7

Description

Hey, devs!
First, thanks for the great project! Really useful and helpful.
I found a weird behavior while experimenting with dictionary keys containing dots (".") in it. Here is the example:
```
>>> from marshmallow import Schema, fields
>>> TestSchema = Schema.from_dict({"something": fields.Str(), "some.thing": fields.Str()})
>>> TestSchema().loads('{"something": "data"}')
{'something': 'data'}
>>> TestSchema().loads('{"some.thing": "data"}')
{'some': {'thing': 'data'}}
```
Is it a correct behavior? How to work around it?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two Schema.from_dict(...).loads(...) examples first, then trace how loads() handles dotted keys. Because no target behavior, file, or test is named, confirm the intended handling with maintainers; done should be an agreed behavior with regression coverage and a documented workaround if needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.