refactoring links toJson