1: Place the items you want to duplicate in a chest.
2: Close the chest window and "Save and quit to title".
3: Go back into your world and take the objects from the chest.
4: Close the chest window and exit the game using Alt+F4.
5: Open the game again and you will have your items in your inventory and in the chest.
(supplied by: acustic)