In this paper, we address the issue of demand response (DR) in microgrids via vehicle-to-vehicle technology in the smart grid with consideration for location privacy protection supported by Internet of Vehicles. To enable effective DR, the online double auction is a viable approach to support energy trading between electric vehicles (EVs) that have surplus or insufficient energy, while the utility of each participant can be considered. Nonetheless, there are three primary challenges in designing such an online double auction approach. First, as EVs are allowed to enter the market at any time, the auctioneer should make the best decision without further information about bids and asks. Second, as EVs are allowed to enter the market in different places, the auctioneer should perform routing optimization for EV charging after determining the winner. Third, there is a risk of leakage in the location of EVs that needs to be protected. To tackle these issues, we present a new truthful online double auction scheme, which features multiunit energy trading among EVs, routing optimization for EV charging, and location privacy protection. We conduct a theoretical analysis and demonstrate that our online double auction scheme is capable of achieving several important economic properties as well as the privacy guarantee (i.e., k -anonymity). Our experimental results show that the proposed scheme can achieve good performance with respect to social welfare, satisfaction ratio, total profit of EV owners, peak load shifting, state of charge, driving distance satisfaction, and computing time, and can further ensure location privacy protection.