demo

import mmap

with open('demo.json', 'r+') as file:
with mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_WRITE) as m:
m[3:5] = 'test'