I looked over the json again and saw that there was nothing wrong. Whoops. 😞 Just thought that might be the case because raw json is what you see if you get it wrong. But I tested it myself, and the bug does only seem to occur when you try to replace the item, but the item is already in that hotbar slot. Removing the book from your inventory before you run the command again will give you the correct book.
I looked over the json again and saw that there was nothing wrong. Whoops. 😞 Just thought that might be the case because raw json is what you see if you get it wrong. But I tested it myself, and the bug does only seem to occur when you try to replace the item, but the item is already in that hotbar slot. Removing the book from your inventory before you run the command again will give you the correct book.