She didn't. (Actually, it took her quite a few years to write all these books.)
J.K Rowling thought of Harry Potter when she was heading toward someones house on the train. She got the idea when her train was delayed
She Thought of it whilst on a train to London
J.K. Rowling was on a British Rail train.
When she was on a train one day.
JK Rowling got the idea in a train going to London.
JK Rowling was a on a Train when she thought: "Why don't I write about a boy going to a wizarding school?" Harry Potter was then born.
A long train journey from Manchester to London.
She was in king cross on a train to Manchester.
She first thought of the idea on a train journey and the characters developed from there :)
She was sitting at a train station and she just started thinking of children who go to a magical boarding school on a train, so she wrote it down and it turned into the Harry Potter books.
When JK Rowling first started writing Harry Potter she wrote it one a napkin in a resturant. My friend told me this :)
J.K. Rowling drew inspiration for Harry Potter from a variety of sources, including her own experiences as a single mother, her love of reading and fantasy literature, and her fascination with folklore and mythology. She also said that the idea for the character of Harry Potter came to her on a train journey.