That's a tricky one. Unless you actually know someone it is very difficult to tell, especially online, where anyone can pretend to be whatever they want to be!
If you are a sociable and easy going person, you will probably want to meet new people online, and that's ok. You just need to remember to set boundaries and not assume that you can trust someone just because they are being friendly. It is possible to check someone out before connecting with them, such as their social media etc. This would give you some idea of whether they are genuine or not. I get regular friend requests on Facebook from people I don't know and I always take a look on their profile page to see if they are genuine or not, or if they are the sort of person I would like to get to know. If I don't like the look of them, or the content of their page, I delete them. Simple.