Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6923053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:29:10+00:00 2026-05-27T10:29:10+00:00

I’m trying to return code like this (can be found here ): {hotspots: [{

  • 0

I’m trying to return code like this (can be found here):

{"hotspots": [{
  "id": "test_1",
    "anchor": { "geolocation": { "lat": 52.3729, "lon": 4.93 } },  
    "text": {
    "title": "The Layar Office", 
    "description": "The Location of the Layar Office", 
    "footnote": "Powered by Layar" },
  "imageURL": "http:\/\/custom.layar.nl\/layarimage.jpeg",
 }], 
 "layer": "snowy4",
 "errorString": "ok", 
 "errorCode": 0
} 

My current webservice code is as follows:

******************RestServiceImpl.vb

Imports System.ServiceModel
Imports System.ServiceModel.Web
Imports System.IO
Imports System.ServiceModel.Activation
Imports System.Web.Script.Serialization
Imports System.Collections.Generic

Namespace RestService

Public Class Employee
    Public Property Id() As String
        Get
            Return m_Id
        End Get
        Set(value As String)
            m_Id = Value
        End Set
    End Property
    Private m_Id As String
    Public Property FirstName() As String
        Get
            Return m_FirstName
        End Get
        Set(value As String)
            m_FirstName = Value
        End Set
    End Property
    Private m_FirstName As String
    Public Property LastName() As String
        Get
            Return m_LastName
        End Get
        Set(value As String)
            m_LastName = Value
        End Set
    End Property
    Private m_LastName As String
End Class

<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class RestServiceImpl
    Implements IRestServiceImpl

    Public Function JSONData(ByVal lat As String, ByVal lng As String, ByVal d As String, ByVal cat As String) As List(Of Employee) Implements IRestServiceImpl.JSONData
        Dim json As New JavaScriptSerializer()
        Dim l As New List(Of Employee)

        Dim e As Employee
        For i As Integer = 0 To 10
            e = New Employee
            e.Id = i.ToString
            e.FirstName = i.ToString + "firstname"
            e.LastName = i.ToString + " lastname"
            l.Add(e)
        Next i
        Return l
    End Function

End Class
End Namespace



******************IRestServiceImpl.vb

Imports System.ServiceModel
Imports System.ServiceModel.Web
Imports System.IO
Imports System.ServiceModel.Activation
Imports System.Collections.Generic

Namespace RestService
<ServiceContract()> _
Public Interface IRestServiceImpl
    <OperationContract()> _
    <WebInvoke(Method:="GET", ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Bare, UriTemplate:="api/objects/json/?lat={lat}&lon={lon}&radius={radius}&cat={cat}")> _
    Function JSONData(ByVal lat As String, ByVal lon As String, ByVal radius As String, ByVal cat As String) As List(Of Employee)
End Interface

End Namespace

This returns:

[{“FirstName”:”0firstname”,”Id”:”0″,”LastName”:”0 lastname”},{“FirstName”:”1firstname”,”Id”:”1″,”LastName”:”1 lastname”},{“FirstName”:”2firstname”,”Id”:”2″,”LastName”:”2 lastname”},{“FirstName”:”3firstname”,”Id”:”3″,”LastName”:”3 lastname”},{“FirstName”:”4firstname”,”Id”:”4″,”LastName”:”4 lastname”},{“FirstName”:”5firstname”,”Id”:”5″,”LastName”:”5 lastname”},{“FirstName”:”6firstname”,”Id”:”6″,”LastName”:”6 lastname”},{“FirstName”:”7firstname”,”Id”:”7″,”LastName”:”7 lastname”},{“FirstName”:”8firstname”,”Id”:”8″,”LastName”:”8 lastname”},{“FirstName”:”9firstname”,”Id”:”9″,”LastName”:”9 lastname”},{“FirstName”:”10firstname”,”Id”:”10″,”LastName”:”10 lastname”}]

But as you can see the required response structure from layer is more complex than my Employee class. How would I be able to return code like that? What should I do in my class definition?

Oh, and I DON’T want to use WCF!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:29:11+00:00Added an answer on May 27, 2026 at 10:29 am

    Looking at one of your response objects you will need to return something like

    Public Class Hotspots
            public int id { get; set; }
            public Anchor anchor { get; set; }
            public Text text { get; set; }
            public string imageURL { get; set; }
            ....
    End Class
    

    Note that Anchor and Text are objects as well.

    I would also recommend wrapping these objects to a response object unless you have different methods returning them separately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.