## Bug description

properties is always assumed to be a valid JSON. Passing invalid JSON will cause 500 internal server error.

https://github.com/PostHog/posthog/blob/99b2f5aea195fb505d671ef74ce0f616631783bd/posthog/models/filters/filter.py#L67

```
httpie :8000/api/insight/trend/ properties==invalid_json Authorization:"Bearer e2e_demo_api_key"
``` 

## Expected behavior

The JSON parsing can be handled to catch the exception and use empty properties.

## Environment

- [ ] PostHog Cloud
- [x] self-hosted PostHog, version/commit: b7b14dd37c1c9951ca37fd41d0d2e9950f2113f0

## Additional context

I was initially using the cloud version which threw internal server error on adding a formula at https://app.posthog.com/insights?insight=TRENDS&interval=day&display=ActionsLineGraph&properties=%5B%5D&filter_test_accounts=false . While reading code I found invalid json to crash the server too. So I thought of filing a bug request.

#### *Thank you* for your bug report – we love squashing them!

A patch with tests. I can convert it into a PR if it's okay

```patch
From ce63211dd6516c361efa09d9a3323807bf6448cf Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Tue, 8 Jun 2021 11:26:26 +0000
Subject: [PATCH] Handle invalid JSON passed through properties.


diff --git a/posthog/api/test/test_dashboard.py b/posthog/api/test/test_dashboard.py
index 1f2f353..c9fa373 100644
--- a/posthog/api/test/test_dashboard.py
+++ b/posthog/api/test/test_dashboard.py
@@ -293,3 +293,8 @@ class TestDashboard(APIBaseTest):
         # Expecting this to only have one day as per the dashboard filter
         response = self.client.get("/api/dashboard/%s/" % dashboard.pk).json()
         self.assertEqual(len(response["items"][0]["result"][0]["days"]), 2)  # type: ignore
+
+    def test_invalid_properties(self):
+        response = self.client.get("/api/insight/trend/?properties=%s" % ("inavlid_json")).json()
+
+        self.assertEqual(response["result"], [])
diff --git a/posthog/models/filters/filter.py b/posthog/models/filters/filter.py
index a6a9488..afc53bf 100644
--- a/posthog/models/filters/filter.py
+++ b/posthog/models/filters/filter.py
@@ -61,10 +61,18 @@ class Filter(
 
     def __init__(self, data: Optional[Dict[str, Any]] = None, request: Optional[HttpRequest] = None, **kwargs) -> None:
         if request:
+
+            properties = {}
+            if request.GET.get(PROPERTIES):
+                try:
+                    properties = json.loads(request.GET[PROPERTIES])
+                except json.decoder.JSONDecodeError:
+                    properties = {}
+
             data = {
                 **request.GET.dict(),
                 **(data if data else {}),
-                **({PROPERTIES: json.loads(request.GET[PROPERTIES])} if request.GET.get(PROPERTIES) else {}),
+                **({PROPERTIES: properties}),
             }
         elif not data:
             raise ValueError("You need to define either a data dict or a request")
-- 
2.17.1

```
posthog/models/filters/filter.py
import json
from typing import Any, Dict, Optional
from django.http import HttpRequest
from posthog.constants import PROPERTIES
from posthog.models.filters.base_filter import BaseFilter
from posthog.models.filters.mixins.common import (
    BreakdownMixin,
    BreakdownTypeMixin,
    BreakdownValueMixin,
    CompareMixin,
    DateMixin,
    DisplayDerivedMixin,
    EntitiesMixin,
    EntityIdMixin,
    EntityTypeMixin,
    FilterTestAccountsMixin,
    FormulaMixin,
    InsightMixin,
    IntervalMixin,
    OffsetMixin,
    SelectorMixin,
    SessionMixin,
    ShownAsMixin,
)
from posthog.models.filters.mixins.funnel_window_days import FunnelWindowDaysMixin
from posthog.models.filters.mixins.property import PropertyMixin
class Filter(