I think your answer may be the btree module
which enables you to create a dictionary on a filesystem and efficiently access it by key.
If you must encode a dict
there are more efficient ways than JSON: see my comments on Protocol Buffers here
. This also discusses `ustruct` which is a way to write pure binary fixed record size data as recommended by @dhylands. JSON is designed to be human readable and is not efficient. CPython's Pickle is much better (non human-readable), but MicroPython's is not.
A fixed record size binary file implies replacing the dict with a set of key-value pairs and iterating over them until you match your key - unless you have a means of computing the offset from the key, in which case you only need to store the values and it becomes highly efficient. This works well with highly structured data such as bitmapped fonts.
I suspect that your data may not be amenable to fixed size records.
If, even with better encoding, the dict is still too big then you'll have to consider other data structures which can be read incrementally such as key-value pairs. Or perhaps the dict could be split into several smaller ones. You trade substantially longer access time for smaller RAM usage.