{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "80138953-40b3-478e-b6d7-12314257d2b6",
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"database.json\", \"r\") as f:\n",
    "    text = f.read()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "8ea9f9aa-292a-4fbd-8990-7c426c751361",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b190f23b-f51a-40c7-8d76-7fb49807413b",
   "metadata": {},
   "outputs": [],
   "source": [
    "obj = json.loads(text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "8a7e8c66-02e9-465e-a5c3-acc19e40b5cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "newText = json.dumps(obj, indent=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f815f61b-5b52-4481-a9ed-d22215746009",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'[\\n    {\\n  '"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "newText[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "e978dbd5-5845-4eae-8fc9-bcd141f6ae3a",
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"database2.json\", \"w\") as f:\n",
    "    f.write(newText)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4c68571e-87e7-454f-b2e5-223fb5480c2f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
